Fix several ResourceWarning: unclosed file (#15746)
Summary:
Hello,
This is a patch to fix `ResourceWarning: unclosed file`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15746
Differential Revision: D13587286
Pulled By: soumith
fbshipit-source-id: 08ac34c5b51d9334867f65a2927bff11511553f3