### Bug report **Bug summary** In an interactive session with a wxpython PyShell, closing a matlotlib figure by clicking on the 'x' in upper right corner causes the python shell to freeze for a few seconds, then it exits without any error message. **Code for reproduction** open PyShell with python ….\lib\site-packages\wx\py\PyShell.py Then run: ```python import matplotlib matplotlib.use('wxagg') matplotlib.interactive(True) matplotlib.pyplot.figure() ``` Then close the figure by clicking on the 'x' in upper right corner. **Expected outcome** Figure closes and shell can be used for further commands. **Matplotlib version** * Operating system: Windows 10 * Matplotlib version: 3.2.2 * Matplotlib backend (`print(matplotlib.get_backend())`): wxagg * Python version: 3.8.3 * Other libraries: wxpython 4.1.0 msw (phoenix) wxWidgets 3.1.4 Installation procedure: Install Winpython64-3.8.3.0dot.exe In winpython's command prompt: pip install wxpython matplotlib **Further notes** Closing the figure with the following command avoids the error: ```python matplotlib.pyplot.close('all') ```