There's a built-in property of the Document object called path, so you should rename your variable to something else.
Also, your file-path has incorrect syntax. Open a file in Acrobat and run this code from the console to see the right syntax to use:
"path" is a keyword within a PDF you should not use keywords as a name for any other object as a general rule.
Have you checked the PDF Reference to see how to create a file path name within a PDF, 3.10.1 File Specification Strings page 118?
The notes following the description:
Thank you. Turns out just deleting that extra variable path made it work. I was using that in an earlier version of my code and forgot it was there. Also my syntax seems to be right.