Move kill session to global teardown (rebased)

This is the same as gh-2428 rebased onto dev_5_0. See details there but it should be a just a case of existing tests passing.

--rebased-from #2428