Issue #10763: subprocess.communicate() closes stdout and stderr if both are
pipes (bug specific to Windows).

Improve also the unit test: write a portable unit test.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 452611c..c12898d 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -985,6 +985,7 @@
 
         def _readerthread(self, fh, buffer):
             buffer.append(fh.read())
+            fh.close()
 
 
         def _communicate(self, input):