Fixed crash issue when exit

Fixed failure on some windows version