Commit 9347db1df97 for nodejs

commit 9347db1df97ba81b7817122ce941db7f82d4ab4c
Author: Filip Skokan <panva.ip@gmail.com>
Date:   Sat Oct 17 08:47:05 2026 +0200

    test: deflake test-filehandle-close

    An fd released with closeSync() can be reused by background I/O before
    FileHandle.close() runs in the thread pool, so closing it can succeed.
    Construct the handle around a high invalid fd to keep the native EBADF
    rejection path deterministic.

    Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-10-15.md
    Signed-off-by: Filip Skokan <panva.ip@gmail.com>
    Assisted-by: Codex
    PR-URL: https://github.com/nodejs/node/pull/66750
    Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
    Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
    Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
    Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>

diff --git a/test/parallel/test-filehandle-close.js b/test/parallel/test-filehandle-close.js
index 6e55f3f06d1..179c62250bb 100644
--- a/test/parallel/test-filehandle-close.js
+++ b/test/parallel/test-filehandle-close.js
@@ -1,14 +1,18 @@
+// Flags: --expose-internals
 'use strict';
 const common = require('../common');
 const assert = require('assert');
-const fs = require('fs');
+const { internalBinding } = require('internal/test/binding');
+const { FileHandle } = require('internal/fs/promises');
+const { FileHandle: NativeFileHandle } = internalBinding('fs');

-// Test that using FileHandle.close to close an already-closed fd fails
-// with EBADF.
+// Test that closing a FileHandle with an invalid fd fails with EBADF.
+// Use a high invalid fd so background I/O cannot reuse it before close runs.

 (async function() {
-  const fh = await fs.promises.open(__filename);
-  fs.closeSync(fh.fd);
+  const fh = common.runWithInvalidFD(
+    (fd) => new FileHandle(new NativeFileHandle(fd)),
+  );

   await assert.rejects(() => fh.close(), {
     code: 'EBADF',