Fix some "resource usage" warnings for unclosed files in tests when running in a CPython debug build.