there is no ) missing, the problem is a quotation puzzle :

IF exist('$opath\'' + split($FileNameXLS,'.')[0] + '.pdf')

should be :

IF exist('$opath\' + split($FileNameXLS,".")[0] + '.pdf')

Show me the line where you create the filename
_________________________