I did it...
I just left the if statement completely out of the equation for the the Title/Metadata query...
I realised that the program actually does one file at a time meaning it will do the sequence of instructions from start to finish per file and then only work on the next file. Therefore, the computer will not get confused with which document title to use for each file.