Added close() for a file that was left dangling