Handle sigterm and sigint