Fix GenEvent stream errors and leaking messages

Previously the GenEvent stream was too defensive on its error handling and would hide when a GenEvent manager exited or the event handler was swapped.

Previously messages could leak from a GenEvent stream because it did not wait for the forwarding of events to stop before flushing its message queue.

Please see the test changes for how behaviour is different.

Note that messages may leak if the `after_fun` raises. It is pointless trying to flush in this case because there is no guarantee messages won't arrive after flushing.