close files, fix ResourceWarning

found using python -Wd setup.py test