Delete orphans rewritten with bmesh api
BUGFIX: Reference error fix in export

Temp mesh delete moved to the end of the file mesh output
to prevent reference error