I would walk the tree and add each node with children to openItems.
I did this recently by running through each item in the tree's dataprovider, and calling expandItem. I'm not sure what the difference is between openItems and expandItem, but expandItem seemed to work.
PFB few good links which can help you
Hope this will solve if it is not yet solved
Thanks a lot. Your answer worked.