OPTICS.fit leaks memory when called under VS Code's built-in debugger

### Describe the bug

Running clustering algorithm with n_jobs parameter set to more than 1 thread causes memory leak each time algorithm is run.
This simple code causes additional memory leak at each loop cycle. The issue will not occur if i replace manifold reduction algorithm with precomputed features.

### Steps/Code to Reproduce

```python
import gc
import numpy as np
from sklearn.manifold import TSNE
from sklearn.cluster import OPTICS
import psutil
process = psutil.Process()


def main():
    data = np.random.random((100, 100))
    for _i in range(1, 50):
        points = TSNE().fit_transform(data)
        prediction = OPTICS(n_jobs=2).fit_predict(points)  # n_jobs!=1
        points = None
        prediction = None
        del prediction
        del points
        gc.collect()
        print(f"{process.memory_info().rss / 1e6:.1f} MB")


main()
```

### Expected Results

Program's memory usage nearly constant between loop cycles

### Actual Results

Program's memory usage increases infinitely

### Versions

```shell
System:
    python: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
executable: .venv\Scripts\python.exe
   machine: Windows-10-10.0.26100-SP0

Python dependencies:
      sklearn: 1.6.0
          pip: 24.3.1
   setuptools: 63.2.0
        numpy: 1.25.2
        scipy: 1.14.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.10.0
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 16
         prefix: vcomp
       filepath: .venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libopenblas
       filepath: .venv\Lib\site-packages\numpy\.libs\libopenblas64__v0.3.23-246-g3d31191b-gcc_10_3_0.dll
        version: 0.3.23.dev
threading_layer: pthreads
   architecture: Cooperlake

       user_api: blas
   internal_api: openblas
    num_threads: 16
         prefix: libscipy_openblas
       filepath: .venv\Lib\site-packages\scipy.libs\libscipy_openblas-5b1ec8b915dfb81d11cebc0788069d2d.dll
        version: 0.3.27.dev
threading_layer: pthreads
   architecture: Cooperlake
```

COMMENT:
Running this code **with regular Python interpreter** will cause memory leak.
There is an insane amount of memory used if clustering models are created `with parallel_backend("loky"):`.
For some reason the memory usage is increasing only for first two-three runs for pool size 8 and five-six for pool size 16, the next runs computes relatively quickly and does not increase memory consumption.
For some reason the memory releases when I start to run same clustering with changed pool size.

```python
import gc
import numpy as np
import asyncio
from joblib import Parallel, delayed
from sklearn.cluster import OPTICS
from joblib import parallel_backend
import psutil

process = psutil.Process()
POOL_SIZE = 8


async def leak_test(loky, i):
    clustering_parameters_list = [
        {"info": {"metric": metric, "clustering_name": "OPTICS"}}
        for metric in ("euclidean", "manhattan", "chebyshev")
    ]

    def clustering_worker(clustering_parameters, loky, i):
        _ = asyncio.run(leak_test_clustering(clustering_parameters, loky, i + 1))
        gc.collect()
        print(f"Run {i}, {clustering_parameters['info']['metric']}")

    for clustering_parameters in clustering_parameters_list:
        Parallel(n_jobs=POOL_SIZE)(
            delayed(clustering_worker)(clustering_parameters, loky, ii)
            for ii in range(i, i + 1)
        )
    return 0


async def leak_test_clustering(clustering_parameters, loky, min_samples):
    points = np.random.random((100, 2))
    if loky is True:
        with parallel_backend("loky"):
            model = OPTICS(
                metric=clustering_parameters["info"]["metric"], min_samples=min_samples
            ).fit(points)
    else:
        model = OPTICS(
            metric=clustering_parameters["info"]["metric"], min_samples=min_samples
        ).fit(points)
    prediction = model.fit_predict(points)
    gc.collect()
    return prediction


if __name__ == "__main__":
    print("POOL_SIZE=8")
    for i in range(1, 5):
        asyncio.run(leak_test(False, i))
        gc.collect()
        print(
            f"after non-loky runs(8): {sum(p.memory_info().rss for p in psutil.process_iter() if p.name() == 'python.exe') / 1e6:.1f} MB"
        )

    for i in range(11, 15):
        asyncio.run(leak_test(True, i + 1))
        gc.collect()
        print(
            f"after loky runs(8): {sum(p.memory_info().rss for p in psutil.process_iter() if p.name() == 'python.exe') / 1e6:.1f} MB"
        )

    POOL_SIZE = 16
    print("POOL_SIZE=16")

    for i in range(21, 25):
        asyncio.run(leak_test(False, i))
        gc.collect()
        print(
            f"after non-loky runs(16): {sum(p.memory_info().rss for p in psutil.process_iter() if p.name() == 'python.exe') / 1e6:.1f} MB"
        )

    for i in range(31, 40):
        asyncio.run(leak_test(True, i + 1))
        gc.collect()
        print(
            f"after loky runs(16): {sum(p.memory_info().rss for p in psutil.process_iter() if p.name() == 'python.exe') / 1e6:.1f} MB"
        )
```

<details>
  <summary>Output</summary>

```
POOL_SIZE=8
Run 1, euclidean
Run 1, manhattan
Run 1, chebyshev
after non-loky runs(8): 659.1 MB
Run 2, euclidean
Run 2, manhattan
Run 2, chebyshev
after non-loky runs(8): 856.7 MB
Run 3, euclidean
Run 3, manhattan
Run 3, chebyshev
after non-loky runs(8): 988.5 MB
Run 4, euclidean
Run 4, manhattan
Run 4, chebyshev
after non-loky runs(8): 988.8 MB
Run 12, euclidean
Run 12, manhattan
Run 12, chebyshev
after loky runs(8): 5526.0 MB
Run 13, euclidean
Run 13, manhattan
Run 13, chebyshev
after loky runs(8): 10064.0 MB
Run 14, euclidean
Run 14, manhattan
Run 14, chebyshev
after loky runs(8): 13090.5 MB
Run 15, euclidean
Run 15, manhattan
Run 15, chebyshev
after loky runs(8): 13094.4 MB
POOL_SIZE=16
Run 21, euclidean
Run 21, manhattan
Run 21, chebyshev
after non-loky runs(16): 926.8 MB
Run 22, euclidean
Run 22, manhattan
Run 22, chebyshev
after non-loky runs(16): 1124.0 MB
Run 23, euclidean
Run 23, manhattan
Run 23, chebyshev
after non-loky runs(16): 1321.4 MB
Run 24, euclidean
Run 24, manhattan
Run 24, chebyshev
after non-loky runs(16): 1519.0 MB
Run 32, euclidean
Run 32, manhattan
Run 32, chebyshev
after loky runs(16): 6252.3 MB
Run 33, euclidean
Run 33, manhattan
Run 33, chebyshev
after loky runs(16): 10855.0 MB
Run 34, euclidean
Run 34, manhattan
Run 34, chebyshev
after loky runs(16): 15391.1 MB
Run 35, euclidean
Run 35, manhattan
Run 35, chebyshev
after loky runs(16): 19931.9 MB
Run 36, euclidean
Run 36, manhattan
Run 36, chebyshev
after loky runs(16): 24464.9 MB
Run 37, euclidean
Run 37, manhattan
Run 37, chebyshev
after loky runs(16): 25977.5 MB
Run 38, euclidean
Run 38, manhattan
Run 38, chebyshev
after loky runs(16): 25979.6 MB
Run 39, euclidean
Run 39, manhattan
Run 39, chebyshev
after loky runs(16): 25981.8 MB
Run 40, euclidean
Run 40, manhattan
Run 40, chebyshev
after loky runs(16): 25981.8 MB
```
</details>

Labels: Bug, Performance, Needs Investigation