Ensure active view remains active when debug windows are closed

In the close_debug_windows() of the view class, debug windows were
closed by each being focused and closed in turn. This left the active
window different from the one the user was originally on.

This fix changes the close_debug_windows() method so before closing the
debug views it stores the currently active view. Then when all debug
windows have been closed it restores this view to being active.