Catch SIGTERM for graceful shutdown.

SIGTERM now mirrors the behavior of SIGINT.

This pull request replaces #56; I created a new one to avoid a messy merge-commit.