#46 fix leak of open files