Fixes #11 -- too many open files

This change explicitly closes the file descriptor so that the code
doesn't depend on the garbage collector to release the resources. This
fixes code that reads or write a lot of files in a loop.