close file and output stream