Close file descriptor on closing encoding instance