diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp
index 5df56a20e256f20133c69d87bce293fabd6632ac..c84ea15d85533c3a87c1743840dca6cbd057f20c 100644
--- a/src/plugins/debugger/qml/qmlengine.cpp
+++ b/src/plugins/debugger/qml/qmlengine.cpp
@@ -628,14 +628,13 @@ void QmlEngine::shutdownInferior()
         resetLocation();
     }
     stopApplicationLauncher();
+    closeConnection();
 
     notifyInferiorShutdownOk();
 }
 
 void QmlEngine::shutdownEngine()
 {
-    closeConnection();
-
     // double check (ill engine?):
     stopApplicationLauncher();