> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# file-handle-not-closed

> A FileHandle from fs/promises open() is not closed on every path, leaking a file descriptor.

## What it flags

A `FileHandle` from `fs/promises` `open()` is not closed in `finally`, so an error before `close()` leaks the file descriptor. Handles that are returned, stored, passed on or turned into a stream are accepted.

## How to review or fix

Confirm nothing else closes it, then close it in `finally` or use `await using`.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "file-handle-not-closed": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.