Shutdown sigterm

These patches resolve dataloss upon SIGTERM. They last one is essentially meant for discussion.

Passes all tests, and adds test for the failure condition it addresses.

Discussion at https://groups.google.com/forum/#!topic/lsyncd/aPV-E49BBFw