Avoid leaking file descriptors.