Fix Command-W behavior for main window