fix leak of open files