I understand how it works, but what's the point of this? If you're determining the window type through a trigger on specific objects, then you should also link the action to the object, not to the window's opening or closing. I still don't understand what opens up the possibility of performing an action after the window closes.
You could just as easily link the action to a touch trigger, and it would execute after that. And if a window opens immediately after a touch (for example, like the Dwelling's recruitment window), then the script written for the touch trigger will wait for the window to close and then execute!
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!
Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.