Mitigate deadlock on shutdown and terminate
Mitigate deadlock on shutdown and terminate

The discord bridge would deadlock in certain cases when exceptions were
thrown or the asyncio event loop stopped.  For example if an uncaught
exception was raised, it would eventually send an exception event, this
event would in turn trigger a termination of the bridge, which would
queue a close() of the bot.  But since the event loop was terminated
this close() would never complete.

Add a check to see if the event loop is running before sheduling close
to the bridge bot on shutdown and terminate.  While this does not solve
all deadlocks as there is still the ever so small posisbility of the
asyncio event loop exiting between the check for it and the subsequent
queue up of the task, it will solve the most frequent deadlocks.

Note: on_channel_add and on_channel_remove also schedules methods on the
event loop, but these should not check if it's running or not, as that
introduces a race when the bridge bot "loses connection".  There is a
small fraction of a period between there where the event loop is not
running.

Hornwitser/YetiBridge