Bug in file close function fixed.