Fix
https://bugs.launchpad.net/ipython/+bug/239054
- Made a more robust reset method to fully flush internal state and restore
the system to a clean state. We'll need to see later if %reset should just
call this. For now it's used to release resources.