Store timeout ID so we can clear in shutdown

Fixes #523