I realize this is a few years old, but I'm experiencing almost the same issue.
My magic number is 4 - iopen the popup, perform a web service call, close the popup 4 times.
I get errors since the TreeView now appears empty.
Can I ask how you finally resolved this?
Thanks in advance.