diff --git a/find/pred.c b/find/pred.c
index e2e8dfb..6588b61 100644
--- a/find/pred.c
+++ b/find/pred.c
@@ -519,12 +519,15 @@ record_exec_dir (struct exec_val *execp)
 
       /* Record the WD. */
       execp->wd_for_exec = xmalloc (sizeof (*execp->wd_for_exec));
+    }
       execp->wd_for_exec->name = NULL;
+      if (execp->wd_for_exec->desc >= 0)
+        close (execp->wd_for_exec->desc);
       execp->wd_for_exec->desc = openat (state.cwd_dir_fd, ".", O_RDONLY);
-      if (execp->wd_for_exec->desc < 0)
+        if (execp->wd_for_exec->desc < 0)
        return false;
       set_cloexec_flag (execp->wd_for_exec->desc, true);
-    }
+
   return true;
 }
