On second thought, committing only just before exiting is much more sensible.