CID#18479 Argument cannot be negative

close doesn't accept a negative value for
fd. Moving this close instruction at the
end of the if statement is the correct
way to proceed.