Use a timer for soft exit.
Fix shutdown order issue.

The io_service needs to be destroyed pretty early on in the shutdown
process, thus it's easier with a heap allocated one.