fix file close bug