diff --git a/IPython/extensions/rmagic.py b/IPython/extensions/rmagic.py index a590fe7..b20939f 100644 --- a/IPython/extensions/rmagic.py +++ b/IPython/extensions/rmagic.py @@ -624,8 +624,8 @@ class RMagics(Magics): print(e.err) rmtree(tmpd) return - - self.r('dev.off()') + finally: + self.r('dev.off()') # read out all the saved .png files