Closed
Description
Register a call back on the DOM element that contains the figure so that when it is removed from the DOM it closes the figure (which if it is the last view of the figure open removes it from Gcf and starts the clean up process).
This addresses the case where users have
fig, ax = plt.subplots()
...
in a cell they keep re-executing.
attn @pelson