properly close files in test_zipfile (#20887)

Patch by Matti Picus.