Moved scope exit down as this fails to compile on windows.

Moved scope exit down as this fails to compile on windows.
What happens if this is called when handle and termInfo are uninitialized ?