Clean up tree memory in destructor.