Check against NULL, not INVALID_HANDLE_VALUE.