fix, tree not cleared on doc closing