Are you trying to run this script with a filemaker user that is using filemaker pro connected to the server? Or are you trying to run it as a server scheduled script?
I'm pretty sure your problem is just your file path in the first line.
Read up on this kbb article about creating file paths in filemaker:
"Invoices/" is a relative path that the filemaker server doesn't understand what to do with.
You should have something like this instead:
"file:" & get(documentspath) & "Invoices/"
That would place it in an "Invoices" folder inside of a user's documents folder.