Roll back changes when an error occurs.