cli: handle SIGTERM/SIGINT more gracefully