Made the refined mesh export happen immediately after refinement, instead of after solution on the refined mesh.