fixes #7720 last record written twice in export