More control over file descriptors closing