Add cleanup method for optionally cleaning up the QTree