The action function that you posted is not making any changes to fields. It is attempting to create output that is sent to the browser. Output is not created and sent to the browser during the update process. Trying to do so is likely creating causing errors.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users