Fix crash on exit windows