Always close files in distutils code and tests (#10252).
diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py
index 99e03d7..4926aa3 100644
--- a/Lib/distutils/command/upload.py
+++ b/Lib/distutils/command/upload.py
@@ -76,7 +76,11 @@
 
         # Fill in the data - send all the meta-data in case we need to
         # register a new release
-        content = open(filename,'rb').read()
+        f = open(filename,'rb')
+        try:
+            content = f.read()
+        finally:
+            f.close()
         meta = self.distribution.metadata
         data = {
             # action