Properly save/restore main window configuration when it maximized