Handling shut down of running and monitor threads in ManageTrees