thanks,
this is an interesting edge case.
when a mod gets triggered by on_gui_opened and closes the gui, all following mods receive the on_gui_closed event before the on_gui_opened event.
my mod now keeps track which guis have been closed that tick.
that should fix it.