Release TreeWalk in recuresive function.