Supporting graceful signal shutdown.

Adding a signal handler and gracefully shutting down all threads.
Merge pull request #251 from vmarmol/shutdown

Supporting graceful signal shutdown.