close files, fix ResourceWarning

found using python -Wd setup.py test

Signed-off-by: Johannes Dewender <github@JonnyJD.net>