Ensure that files in tests are closed.

This is needed on Pythons which do not have
reference counting GCs (e.g. PyPy).

Change-Id: I5a613e832e9a7a149b3e9317c053c3048f34afcb
Merge "Ensure that files in tests are closed."