How to close a full-screen figure?

Does anyone happen to know how I may close a full-screen matplotlib window? I spawned the figure using:

plt.ion()
fig = plt.figure('Optimizer')
plt.tight_layout()
mng = plt.get_current_fig_manager()
mng.full_screen_toggle()

However, plt.close("all") does not seem to do anything, and I couldn’t find many things online to try that are relevant to full-screen figures. Seems like the behavior of closing figures differs for full-screen plots?

I have to manually kill -9 the entire script for it to close.

Running on a Raspberry Pi if that matters - Thanks in advance!

maybe mng.destroy()?

In what context are you running this? Is the figure otherwise interactive while you can not kill it? Does the default keybinding 'q' close the window?

If you are not actually in an interactive prompt or otherwise running the event loop you may need to do so (plt.show(block=True) or plt.pause(1) ) .

Also see
https://matplotlib.org/stable/users/explain/interactive.html