diff --git a/spyder/plugins/ipythonconsole.py b/spyder/plugins/ipythonconsole.py
index <HASH>..<HASH> 100644
--- a/spyder/plugins/ipythonconsole.py
+++ b/spyder/plugins/ipythonconsole.py
@@ -1249,8 +1249,12 @@ class IPythonConsole(SpyderPluginWidget):
         if index is not None:

             client = self.tabwidget.widget(index)

 

-        # Close client

-        client.stop_button_click_handler()

+        # Needed to handle a RuntimeError. See issue 5568.

+        try:

+            # Close client

+            client.stop_button_click_handler()

+        except RuntimeError:

+            pass

 

         # Check if related clients or kernels are opened

         # and eventually ask before closing them
Add handling for RuntimeError while closing an IPython console instance.