Ensure the script exits cleanly if nothing went wrong.