#5179: don't leak PIPE fds when child execution fails.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 309f5d4..d91fbee 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1151,6 +1151,9 @@
             if data != "":
                 os.waitpid(self.pid, 0)
                 child_exception = pickle.loads(data)
+                for fd in (p2cwrite, c2pread, errread):
+                    if fd is not None:
+                        os.close(fd)
                 raise child_exception