Added ability to close files