Well.. you can set the variable isfinished = true in the main event..
because doesn't matter if the value is odd or even, you will always set true to the boolean..
So, if the main event is true, it always will be isfinished = true.. does it matter if sets before or after?
Even if you have another event comparing if isfinished = true, as I undestand, it will always finish the main event and subevents before trigger other main event.
Edit: or you can just have a last blank sub event, parent of the main event with action set isfinished = true.. it will always run but last