Implemented pre_term_timeout including test

Implements the same functionality but includes a test of the signal handling to make sure things are working properly.

See https://github.com/resque/resque/pull/1136 for a description of the use case for this code.
Breaking change: we intentionally trap secondary `SIGTERM`s, but that is not reflected in the result of this patch.