Fixed window being shown off the screen.
Now saves window state.