fixed memory leak. the parser tree was not freed before the end