Fixed error where multiple root nodes were created when script is run multiple times without closing window.