Problem: Undo misbehaves when writing from an insert mode mapping. Solution: Sync undo when writing. (closes #11674)