fix: rollback on exception
diff --git a/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py b/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py
index ddf70aa..3af7dac 100644
--- a/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py
+++ b/erpnext/patches/v13_0/modify_invalid_gain_loss_gl_entries.py
@@ -52,7 +52,9 @@
 					advance.db_set('exchange_gain_loss', 0, False)
 			doc.docstatus = 1
 			doc.make_gl_entries()
+			frappe.db.commit()
 		except Exception:
+			frappe.db.rollback()
 			print(f'Failed to correct gl entries of {invoice.name}')
 
 	if acc_frozen_upto: