Add handler for SIGTERM in daemon mode