I might have a trick for you: since the process begins from the scanned document then maybe you can end the 2-nd task not when an invoice is created but when the scanned document is linked to it.
I've done so a few times for DMS documents, you will have to use a function module to receive the DRAW object event and check if an invoice was linked but it's possible.