Close files explicitly.

This should prevent "OSError: Too many open files" errors.
Merge pull request #2 from kmike/close-files

Close files explicitly