Fixing leaking file descriptors.