Error code

Windows ERROR_INVALID_HANDLE

WINDOWSERROR_INVALID_HANDLE
System Error Code· A POSIX/system errno returned when a system call fails.

What it means

The handle is invalid..

How to fix it

  1. Ensure the handle was successfully opened before use and check the open call's return value.
  2. do not reuse a handle after CloseHandle.
  3. verify the handle was not closed on another thread.
  4. restart the application to clear stale state.

Not affiliated with Windows. Answer summarized from the manufacturer's manual linked above; consult that source for the authoritative procedure.