Add (optional) confirmation dialog on exit