bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)

diff --git a/Tools/scripts/pdeps.py b/Tools/scripts/pdeps.py
index f8218ac..4e8e930 100755
--- a/Tools/scripts/pdeps.py
+++ b/Tools/scripts/pdeps.py
@@ -64,29 +64,28 @@
 # Collect data from one file
 #
 def process(filename, table):
-    fp = open(filename, 'r')
-    mod = os.path.basename(filename)
-    if mod[-3:] == '.py':
-        mod = mod[:-3]
-    table[mod] = list = []
-    while 1:
-        line = fp.readline()
-        if not line: break
-        while line[-1:] == '\\':
-            nextline = fp.readline()
-            if not nextline: break
-            line = line[:-1] + nextline
-        m_found = m_import.match(line) or m_from.match(line)
-        if m_found:
-            (a, b), (a1, b1) = m_found.regs[:2]
-        else: continue
-        words = line[a1:b1].split(',')
-        # print '#', line, words
-        for word in words:
-            word = word.strip()
-            if word not in list:
-                list.append(word)
-    fp.close()
+    with open(filename) as fp:
+        mod = os.path.basename(filename)
+        if mod[-3:] == '.py':
+            mod = mod[:-3]
+        table[mod] = list = []
+        while 1:
+            line = fp.readline()
+            if not line: break
+            while line[-1:] == '\\':
+                nextline = fp.readline()
+                if not nextline: break
+                line = line[:-1] + nextline
+            m_found = m_import.match(line) or m_from.match(line)
+            if m_found:
+                (a, b), (a1, b1) = m_found.regs[:2]
+            else: continue
+            words = line[a1:b1].split(',')
+            # print '#', line, words
+            for word in words:
+                word = word.strip()
+                if word not in list:
+                    list.append(word)
 
 
 # Compute closure (this is in fact totally general)