Fixed crash when exiting on windows with libdarnit compiled using O3 flag

Fixed crash when exiting on windows with libdarnit compiled using O3 flag