In general you should strive to avoid auto-commits. I think you need to make a decision whether you're committing data or not as users are entering it. My initial recommendation would be to keep everything in memory until you're ready to save.
You state:
I do not want to use over association because then an invoice line is deleted when you press the cancel button.
If you're trying to avoid deleting the InvoiceLines when the Invoice cancel button is clicked, you have a few options:
Option A: Turn the cancel button into an action button: in a microflow:
Option B: Turn the InvoiceLine save button into an action button