save main window state and geometry