I consolidated the `_cleanup_keys` and `purge_keys` functions into this `cleanup` function. Since all `_cleanup_keys` did was set `self._comm_key = None` and call `purge_keys`.

The only effective change here is that `_comm_key` is set before rather than after. Which didn't change anything in testing. But I can move it to after.