Fixed crash on program stop with windows