ensure File.close is called