Where is your pagefile?
I would recommend putting it on a dedicated volume to make it faster. Ideally, you would put it on a different physical drive from the one the OS is installed on (so long as it is less frequently used than the OS drive). If that is not possible, then at least put it in its own partition (as close to the start of the drive as possible) to ensure that it remains un-fragmented.
When you minimize or idle a program for a while, Windows pages its memory out to the swapfile on disk. When you close it, that memory has to be freed even if it is not in RAM (in which case, it has to be marked as free in the swapfile).
By optimizing the swapfile, when you close your memory-heavy programming apps, the OS will be able to page back in the memory from other programs in a much more reasonable amount of time.
Failing that, patience is a virtue. (I have had plenty of times—eg encoding a video with the program set to real-time priority!—when the system was so bogged down by something that the mouse not only froze, but the keyboard even locked up such that the *-Lock LEDs would not change, and the internal speaker beeped. In most cases, unless it was a full-on crash-worth hang, waiting long enough would eventually fix it—assuming I had enough patience to wait.)
Like I said in my first comment. I would examine the CPU usage. While it is normal for the drive to thrash when memory is freed, it rarely causes the mouse to actually stutter. That is usually due to a high-priority process using a lot of CPU. Examine the Task Manager (or Process Explorer since it has a trace graph), to examine what process is using up the CPU to help narrow down the problem.
If the process that is spinning the CPU is the programming app’s (ie, the app is closed, but the process is still hanging around to finish cleaning up), then can use TaskMan (or ProcExp) to set it to low-priorty so that you can continue to use your system while waiting for it to finish.
It also occurs to me that another thing that could be causing the issue is CPU throttling. After closing a large program like development environments, the system does a lot of clean up, so watch your CPU usage and temperature. Does it use a lot of cycles during the clean up process? Does the temperature go up? Perhaps the motherboard is configured to throttle the CPU once it reaches a certain temperature, thus causing the whole system to slow down, including the responsivenesses of the mouse cursor and keyboard.