Added close option to allow set tree to folded up 

By adding an optional close parameter (which defaults to false) the user can now specify whether the tree is folded up when it's created.