handle sigint and sigterm