Added a SIGUSR1 handler to cleanly shut down the slave.

Review: https://reviews.apache.org/r/21379/
Added a SIGUSR1 shutdown test.

Review: https://reviews.apache.org/r/22737