Fix manager unregisters or exits during GenEvent stream

Previously if a manager unregistered, the handler would not be removed
during cleanup. This could occur due to a netsplit when registered using
a distributed register such as :global.

Previously if the manager exited without sending the :gen_event_EXIT
message the stream would not stop. This could happen if the GenEvent was
on a disconnected node or was killed.