Closing python matplotlib window not possible

Hi, I create (for quick testing and prototyping) some matplotlib windows from my segmenteditor effect (in the callback of the apply button) like described here:

Unfortunately, it is not possible to close the window after use. Any ideas why this happens? Thanks.

You can find various ways of plotting using matplotlib here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Using_matplotlib (including rendering in a static qt window, which can be surely closed without problems).