Close the scandir handle in available_configs (#6091)
`available_configs()` yields from inside a bare `scandir()` loop.
`scandir()` holds an open directory fd until the iterator is exhausted,
closed or collected, so a consumer that stops iterating early leaves it
to the garbage collector. This wraps the scan in a `with` block, which
is the form the `os.scandir` docs recommend for exactly this case.
This is a hygiene fix rather than a user-facing bug. CPython closes the
fd as soon as the abandoned generator is collected, so nothing
accumulates in practice.
Notes:
- Reproduction: take one entry, drop the generator, collect. On current
main that emits `ResourceWarning: unclosed scandir iterator`; with the
fix, nothing.
- The early exit happens in `test_can_find_config_files`, which breaks
after the first entry. `config_for_legacy_use` also returns from inside
the loop, but it is only reachable from `get_config`, which the
integration itself never calls.
- What it buys: no ResourceWarning where warnings are escalated to
errors, and a deterministic close rather than one that depends on
refcounting.
- Added a regression test, which fails without the fix.
- ruff, yamllint and the full pytest run pass locally.