<s>[INST] I have a node.js project with the following requirements:

- Only use core Node.js modules (i.e. no external dependencies).
- The code should be completely asynchronous.
- The code should be readable and maintainable (e.g. use descriptive variable names, comments, etc.).

Here is an example of what the `test.js` file looks like:

```javascript
const { rm } = require('fs/promises');
const path = require('path');
const timers = require('timers');

module.exports = async function test() {
  const rootDir = path.join(process.cwd(), 'test');
  const testDir = path.join(rootDir, 'example');

  const cleanUp = async () => {
    await rm(testDir, { recursive: true, force: true });
  };

  const createTempDir = async () => {
    try {
      await fs.promises.mkdir(testDir);
      await cleanUp();
    } catch (err) {
      console.error(err);
    } finally {
      await cleanUp();
    }
  };

  await createTempDir();

  // Put additional test code here
};

test();
```
The problem I encountered is that there are a few places where the `cleanUp` function is being called, and I'm worried that this function can be called multiple times (because it's being awaited) and might cause unexpected behavior (e.g. errors).

My goal is to design the `cleanUp` function to run only once when the program exits (e.g. via `process.exit()` or via an uncaught exception).

Here is an example of what I'd like the `cleanUp` function to look like:

```javascript
process.on('exit', cleanUp);
process.on('SIGINT', cleanUp);
process.on('SIGTERM', cleanUp);
process.on('uncaughtException', cleanUp);
process.on('uncaughtRejection', cleanUp);

// however, this approach won't work because the `cleanUp` function depends on the `testDir` variable
const cleanUp = async () => {
  // ...
};
```
How would you solve this problem?[/INST]