Improved use of redis mutex so it's always released.
Improved shutdown logic so redis connection is always closed and the
reason for the shutdown is always logged. We wait for the mutex when
shutting down so running handlers are not stopped in mid-transaction.
We hold the mutex when shutting down so all other handlers are
prevented from running against the database.
Added a signal handler to gracefully catch aborts.