Make sure we roll back created records when an import is cancelled.

Also fixed a bug where only the last batch's records were linked to the import job.