Close the RFS and kill the root session. (rebased)

See gh-2188. The affected tests should pass.

--rebased-from #2188