Only store window geometry if the window is in "Windowed" state
So that we don't read the maximized size and store that in the config, which means restoring a maximized state would appear to do nothing.
Also ensure the window size is properly set when going from Maximixed to Windowed.