I don't believe there's an instance where a handle would be closed implicitly in this case. For what it's worth, the error code (4) corresponds to
HandleError_Index (though I don't know enough about the handle system to explain the meaning of that).
Would like to see a small reproduction case; could be some quirk in the enum structs or in your code.
----
There is a limit of (1<<15) handles, but it's unlikely you'd unknowingly hit that limit.
Handles are not destroyed without explicit calls to
delete or
CloseHandle, including those in container-like structures.
__________________