Problem:
The early return for an invalid window handle bypasses the
`set_destroy()` at the end of the block, so the set's backing allocation
leaks whenever an earlier iteration already called `set_put()`.
Triggered by `{ wins = { valid_win, 9999 } }`.
Solution:
Destroy the set before returning.
The new test passes either way, since the leak is only visible to a
sanitizer; it is there so the ASAN job covers the path.
AI-assisted