Fixed a windows crashing on exit bug.