Fix rewrite handling logic in beancount-tree-writer

Created by  korrat  on November 14, 2023
TDB5HJSWMC6Q5RSH4NXZJWP2XAEOF75CXXOKSIG35NCMX75YDUWQC
Change contents