Renamed unit_closure to detail::unit_trail. It shall not yet go to the public interface. Added tests for fixes around ticket #5207.