Exit gracefully when SIGTERM received. Fixes #40.