dont attmpt to close fd if its nil