Make sure file descriptors are not leaked after use.