Resource cleanup issues in dataset loaders: files opened but not closed.

### Describe the bug

Two dataset loader functions in `sklearn.datasets` have resource cleanup issues where files are opened but not properly closed using context managers, potentially leading to resource leaks.

The first one is more important:
### in _lfw.py:
Line 172:  `pil_img = Image.open(file_path)` -  an image is opened each iteration of the loop.
The file handle is never explicitly closed. 
PIL does not always immediately close the file. This can exhaust file descriptors.

This one is less severe:
### In _kddcup99.py:
Lines 390 - 394: The file is opened and manually closed using `file_.close()`, but not inside a `try`/`finally` or `with` block.
file_.close() appears after a loop without exceptions. This means that if an error occurs in the loop, the file remains open.

### Steps/Code to Reproduce

Code snippet shouldn't be necessary - 
### Primary Issue in _lfw.py
Opening many images without closing can exhaust system file descriptors
Unclosed file handles can prevent garbage collection
Applications or notebooks that repeatedly fetch the dataset could accumulate thousands of unclosed files
### Secondary Issue in _kddcup99.py
If line.decode() fails (encoding issues), file remains open.
If Xy.append() fails (memory constraints), file remains open.
Keyboard interruption during process, file remains open.

### Expected Results

All files should be opened using context managers, or 
```python
with Image.open(file_path) as pil_img:
    # processing
```
ensuring proper closure even if exceptions are raised. This ensures file handles are released immediately, and code is safe under interruption or failure.

### Actual Results

Files are opened without being explicitly closed, leading to:
Exhaustion of file descriptors when loading the dataset multiple times, unexpected behavior under memory pressure or long sessions.

### Versions

```shell
System:
    python: 3.13.2 (tags/v3.13.2:4f8bb39, Feb  4 2025, 15:23:48) [MSC v.1942 64 bit (AMD64)]
executable: C:python.exe
   machine: Windows-10-10.0.19045-SP0

Python dependencies:
      sklearn: 1.6.1
          pip: 25.1.1
   setuptools: 80.9.0
        numpy: 2.2.6
        scipy: 1.15.2
       Cython: 3.1.2
       pandas: 2.2.3
   matplotlib: 3.10.1
       joblib: 1.4.2
threadpoolctl: 3.6.0

Built with OpenMP: True

threadpoolctl info:
       user_api: openmp
   internal_api: openmp
    num_threads: 6
         prefix: vcomp
       filepath: C:\Python\Python313\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 6
         prefix: libscipy_openblas
       filepath: C:Python\Python313\Lib\site-packages\numpy.libs\libscipy_openblas64_-13e2df515630b4a41f92893938845698.dll
        version: 0.3.29
threading_layer: pthreads
   architecture: Haswell

       user_api: blas
   internal_api: openblas
    num_threads: 6
         prefix: libscipy_openblas
       filepath: C:\Python\Python313\Lib\site-packages\scipy.libs\libscipy_openblas-f07f5a5d207a3a47104dca54d6d0c86a.dll
        version: 0.3.28
threading_layer: pthreads
   architecture: Haswell
```

COMMENT:
I'm currently working on a fix for this. I've implemented changes in _lfw.py and _kddcup99.py to use context managers for safe file handling. I'm just sorting out a local build issue before I can run the test suite to validate the changes. I will submit a PR as soon as I confirm tests are passing.

Labels: Bug, Needs Triage