Backport 60334:
On some systems (e.g., Ubuntu on hppa) the flush()
doesn't (always) cause the exception, but the close() does.
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 29ce35b..28876e3 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -36,6 +36,9 @@
     try:
         f.write("Y")
         f.flush()
+        # On some systems (e.g., Ubuntu on hppa) the flush()
+        # doesn't cause the exception, but the close() does.
+        f.close()
     except IOError:
         if not limit_set:
             raise