diff --git a/lib/bb/command.py b/lib/bb/command.py
index 20a8b86653..1224eee413 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -152,6 +152,9 @@ class Command:
             bb.event.fire(CommandExit(code), self.cooker.data)
         else:
             bb.event.fire(CommandCompleted(), self.cooker.data)
+        self.finishAsyncDisconnect()
+
+    def finishAsyncDisconnect(self):
         self.currentAsyncCommand = None
         self.cooker.finishcommand()
 
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 6f43330fae..c9984539e8 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -177,6 +177,7 @@ class ProcessServer():
                 self.command_channel = False
                 del self.event_writer
                 self.lastui = time.time()
+                self.cooker.command.finishAsyncDisconnect()
                 self.cooker.clientComplete()
                 self.haveui = False
             ready = select.select(fds,[],[],0)[0]
