set close to see if fd is even open before trying to close it