Void family only cuts with dynamo script when I run the script two times

The attached script places familys at points on a selected surface in Revit and then cuts the placed familys with a void family. It works, but only when I run it twice. Can someone help to figure out why this is happening?
The first time it creates the familys at the points and the void family is created.
The second time after I reselected the face and run the script, it actually cuts the placed family with the placed void family. I dont inderstand why it doesnt do it the first time.
Attached are some printcreens and the dynamo script.

test1.dyn (76.8 KB)
Wouter

You need to commit your transaction to the revit database before the cutting can happen. This usually happens at the end of the script, so that the second time you run your script, your cutting node has something to cut because it was there at the start of the run.

Try adding a Transaction.End node after the node that creates the void and see if that fixes it.

Many thanks!
Your suggestion has solved the problem.
I had to place the transaction end node after create the void and after creating the familys. Makes sense now I know this.
Regards,
Wouter