Fix crash in SafePipeHandle.ReleaseHandle() on Windows (#3797)