Fix AMQPOutput deadlocks at shudown.

Hopefully closes #824.