Put an indicator for the filepath and have a look at the path that you are using. I don't know how you are creating the path, and if it populates the path automatically.
From what I understand from your post, it appears that you are going to the next file which does not exist. If that is the case, then you could verify if the file is valid and select the appropriate action using a Case Statement.
In other words: The file open portion of the code would be in a Case Statement. Ifthe path exists, then write to the file. The function you will need isunder File IO > Advanced > Check if File or Folder Exists.vi