The best time to enforce this would be to do it while you build up the tree. Take a look at the attached VI.
Basically whenever you add an element you need to do 2 things. Call the Open/Close Item method and close your the new tag. Then call Ensure Visible on the parent.
The reasoning behind this is that if an item is closed, and you add a child it will not open, therefore when one of your children becomes a parent the child will not show up. However as you get deeper you need to ensure that the parent shows up, even if it is a child.
So in my example I create parents and some children, which are nicely closed. I then add some children to 1 child. Notice the newest child is hidden but the parent shows up. I also wanted to point out that somet
imes children may show up like in this example where a child and parent are the same level.
Another option would be to store in an array all the children tags, and you can call Close on all them in a loop.