implement R Markdown render terminate