Added close() call for file streams (discovered error in scala)