Workaround for freeze on exit issue in Windows