Fix for when all listeners are unregistered and the channel is destroyed...

When all listeners on the events API are removed, the channel is closed, but the go routine that is watching that channel is still posting events to it.  This change uses the global channel instead of the locally scoped one, and has a check for when there are no active listeners it will not attempt to post events to the closed channel.