Naming series increase even if there is an exception while saving the invoice from the backend (#14938)

diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 63db16c..a515724 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -507,5 +507,6 @@
 			name_list.append(name)
 	except Exception:
 		frappe.log_error(frappe.get_traceback())
+		frappe.db.rollback()
 
 	return name_list