What I do is close the inlet valve, disconnect the inlet valve, let the pump remove some of the water from the filter, close the outlet valve then unplug the filter. The quicker you're able to go through these steps, the less stress you're putting on the pump.
The reason it's not working for you is because the water from the filter that you're trying to pump out needs to be replaced with something. When the filter is in normal operation the water from the filter is simply replaced with water from the tank. When you shut the inlet valve, you're restricting the filter from receiving anything to replace the filter water so it won't be able to pump anymore. However, when you remove the inlet valve after closing it then the filter water can then be replaced with air. Hope that makes sense to you.