Real-time Workflows roll back all changes if it fails. As the Workflow is going through the process itself, if it fails, it will roll back all of the prior steps taken. Reference: https://ledgeviewpartners.com/blog/what-are-the-differences-between-real-time-and-background-workflows-in-microsoft-dynamics-365-crm/