added finalize to jinja2 envoronment