fix file close