fix leak open file descriptors