Close file descriptors if strdup(3) call fails