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

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