diff --git a/conftest.py b/conftest.py
index c989bd81b7443900b7e4d2953b5be6ea73763b91..6593418f73cbc63d77f384f422772c94ce07afba 100644
--- a/conftest.py
+++ b/conftest.py
@@ -107,6 +107,7 @@ class IPyNbTest(pytest.Item):
 
         # disable matplotlib output
         exec("import matplotlib.pyplot as p; "
+             "p.close('all'); "
              "p.switch_backend('Template')", global_dict)
 
         # in notebooks there is an implicit plt.show() - if this is not called a warning is shown when the next