Small fixes for startup and main window closed