Fixed crash because of CloseHandle