exit cleanly on signals