Prevent crash on exit.