I am posting this having already solved the issue, as a help to other users.
I have a Nintex workflow on a SharePoint 2013 site. I am setting item level permissions on two lists, running in parallel, using a For Each to loop through each item. The workflow always finishes, but if there are too many records (800 in the larger list) I get an error at the end:
An error has occurred in Remove Permissions.
The workflow updated all of the records, it just gave me the error at the end. If there are fewer records, I don't get the error.
I tried all of the suggestions listed on this forum, adding an End Workflow, Commit Pending Changes, Pause at the beginning and/or the end, nothing worked.
Finally, I figured out what was happening. Updating every single item's permissions is time-consuming. The workflow tells SharePoint to update the item, and then moves on to the next item in the For Each. The WORKFLOW is finished, and reaches the end, but SharePoint is still churning out the changes. The workflow somehow senses this, and throws an error.
The solution is, I have a counter within each loop. After 150 records (I have fine-tuned, and 150 seems to be the max), I pause for one minute. Since the pause is tied to the Timer service, that one minute can be up to FIVE minutes, but I have no control over that. I then reset the counter.
So, every 150 records, I pause to let SharePoint catch up the workflow. When the workflow ends, SharePoint ends, and no error. It makes the workflow run for a half-hour, but that's a small price to pay to avoid an error that is meaningless and leaves the workflow hanging.