diff --git a/src/app/MainApplicationWindow.qml b/src/app/MainApplicationWindow.qml
index f75732477fed88dbc78bd380e267272bd5be6adf..59ad7cef2a58de45ee83c2829bf5f8afc74b405d 100644
--- a/src/app/MainApplicationWindow.qml
+++ b/src/app/MainApplicationWindow.qml
@@ -122,9 +122,6 @@ ApplicationWindow {
         // If we're in the onboarding wizard or 'MinimizeOnClose'
         // is set, then we can quit
         if (force || !UtilsAdapter.getAppValue(Settings.MinimizeOnClose) || !UtilsAdapter.getAccountListSize()) {
-            if (checkLoadedSource() === MainApplicationWindow.LoadedSource.MainView) {
-                cleanupMainView();
-            }
             Qt.quit();
         } else {
             layoutManager.closeToTray();
@@ -233,6 +230,10 @@ ApplicationWindow {
     Connections {
         target: MainApplication
 
+        function onAboutToQuit() {
+            cleanupMainView()
+        }
+
         function onCloseRequested() {
             close(true);
         }