Properly close a file in test_minidom.
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index 97668d3..7b845ef 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -73,9 +73,10 @@
         self.confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t)))
 
     def testParseFromFile(self):
-        dom = parse(open(tstfile))
-        dom.unlink()
-        self.confirm(isinstance(dom, Document))
+        with open(tstfile) as file:
+            dom = parse(file)
+            dom.unlink()
+            self.confirm(isinstance(dom, Document))
 
     def testGetElementsByTagName(self):
         dom = parse(tstfile)