Prevent quadruple-free error on shutdown
Merge pull request #688 from Metaswitch/crash_on_shutdown

[Reviewer: Andy] Prevent quadruple-free error on shutdown