Additional work for VIX-340.
Add support to restore the window to maximized if it was closed when maximized. Add some sanity checks to make sure it is on the screen.