close file handles after writing