title: How to make plt.pause() work if last open figure is closed
body: <p>I am trying to create a bunch of matplotlib figures in my python 3 script. The script runs infinitely and plots things depending on the user's input. I need to use a plt.pause() in some of the script, since time.sleep() won't work in my case.</p>
  
  <p>I seem to be having an issue, where the user can close any figure except for the last one that was created. Let's say, for example, that the user creates 3 figures. If the script is in the plt.pause, and the user closes Figure #1 or Figure #2, everything works as it should. However, if the user closes just Figure #3, the script crashes and i get an error: _tkinter.TclError: can't invoke "update" command: application has been destroyed</p>
  
  <p>I need to use the tkagg back end because I am using tkinter.</p>
  
  <p>Below is a short script that demonstrates the issue. You will come up with the error if the script is in the plt.pause() and you close the last created figure. </p>
  
  <pre><code>import matplotlib;
  matplotlib.use("tkagg");
  import matplotlib.pyplot as plt;
  
  fig1 = plt.figure();
  plt.pause(2);
  plt.show(block=False);
  
  fig2 = plt.figure();
  plt.pause(2);
  plt.show(block=False);
  
  fig3 = plt.figure();
  plt.pause(2);
  plt.show(block=False);
  
  input("done");
  </code></pre>
  
  <p>Is there any way so make it so that the plt.pause() is not dependent on just the last opened figure? maybe I can have a "fake" figure that is never shown that the plt.pause() uses?</p>
  
  <p>Thanks</p>