Gracefully close worker on term.

This change (attempts to) add a signal handler to the worker allowing it
to gracefully shutdown on a TERM signal. This means that it will finish
the tasks that it has accepted but not request any more work.
Merge pull request #399 from danielhfrank/graceful-shutdown

Gracefully close worker on term.