Make app shutdown when main window closed.