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

diff --git a/Tools/scripts/fixnotice.py b/Tools/scripts/fixnotice.py
index ad967f9..317051d 100755
--- a/Tools/scripts/fixnotice.py
+++ b/Tools/scripts/fixnotice.py
@@ -73,22 +73,19 @@
         elif opt == '--dry-run':
             DRYRUN = 1
         elif opt == '--oldnotice':
-            fp = open(arg)
-            OLD_NOTICE = fp.read()
-            fp.close()
+            with open(arg) as fp:
+                OLD_NOTICE = fp.read()
         elif opt == '--newnotice':
-            fp = open(arg)
-            NEW_NOTICE = fp.read()
-            fp.close()
+            with open(arg) as fp:
+                NEW_NOTICE = fp.read()
 
     for arg in args:
         process(arg)
 
 
 def process(file):
-    f = open(file)
-    data = f.read()
-    f.close()
+    with open(file) as f:
+        data = f.read()
     i = data.find(OLD_NOTICE)
     if i < 0:
         if VERBOSE:
@@ -102,9 +99,8 @@
     data = data[:i] + NEW_NOTICE + data[i+len(OLD_NOTICE):]
     new = file + ".new"
     backup = file + ".bak"
-    f = open(new, "w")
-    f.write(data)
-    f.close()
+    with open(new, "w") as f:
+        f.write(data)
     os.rename(file, backup)
     os.rename(new, file)