Profile stop, restart and delete release the profile's handles through
hermes_state_registry.close_all_under(), which tears the generation
down. The gateway's per-path handle caches (the session store's, and
the runner's async wrapper around it) kept serving that dead SessionDB.
Its close-race self-heal then reopened a writer the registry does not
know about: the agent's next acquire() got a second writer on the same
file, and later close_all_under() calls could not release it. After a
delete and same-name recreate, every call raised StateDbReplacedError,
and the leaked handle kept the old WAL open, so other processes refused
to open the recreated store.
Remember which cached handles the registry owned, and when the registry
has since torn one down, drop it and reopen through the registry.