Tentative fix for #1747.

The the theory is that the closing the file handle when the process terminates races with the reader threads, and if the closing happens not while a system call is running but between two, nativeReadStream() would return an error.

--
MOS_MIGRATED_REVID=132851092
diff --git a/src/main/native/windows_processes.cc b/src/main/native/windows_processes.cc
index 21e1b24..fb3fb83 100644
--- a/src/main/native/windows_processes.cc
+++ b/src/main/native/windows_processes.cc
@@ -352,17 +352,17 @@
   NativeOutputStream* stream =
       reinterpret_cast<NativeOutputStream*>(stream_long);
 
-  if (stream->handle_ == INVALID_HANDLE_VALUE || stream->closed_.load()) {
-    stream->error_ = "File handle closed";
-    return -1;
-  }
-
   jsize array_size = env->GetArrayLength(java_bytes);
   if (offset < 0 || length <= 0 || offset > array_size - length) {
     stream->error_ = "Array index out of bounds";
     return -1;
   }
 
+  if (stream->handle_ == INVALID_HANDLE_VALUE || stream->closed_.load()) {
+    stream->error_ = "";
+    return 0;
+  }
+
   jbyte* bytes = env->GetByteArrayElements(java_bytes, NULL);
   DWORD bytes_read;
   if (!ReadFile(stream->handle_, bytes + offset, length, &bytes_read, NULL)) {