ENG-6428: make persistent binary deck clean empty segments, tests and refactor.
(cherry picked from commit 0d1c938a38f34381cdb244c2a34546c5b33e983c)