diff --git a/qt/applications/workbench/workbench/plotting/figuremanager.py b/qt/applications/workbench/workbench/plotting/figuremanager.py
index 0346869b9e896142f803497c33895b42a7df5a1e..ce62dda5a40bd473fe86d529da1390d3070c513d 100644
--- a/qt/applications/workbench/workbench/plotting/figuremanager.py
+++ b/qt/applications/workbench/workbench/plotting/figuremanager.py
@@ -259,6 +259,15 @@ class FigureManagerWorkbench(FigureManagerBase, QObject):
         del self._ads_observer
         for id in self._cids:
             self.canvas.mpl_disconnect(id)
+        self.window.close()
+
+        try:
+            Gcf.destroy(self.num)
+        except AttributeError:
+            pass
+            # It seems that when the python session is killed,
+            # Gcf can get destroyed before the Gcf.destroy
+            # line is run, leading to a useless AttributeError.
 
     def grid_toggle(self):
         """