Gracefull shutdown on SIGTERM

Signed-off-by: Paul Brook <paul@nowt.org>