Probably the easiest way is just trying to open it and trapping the error. So assuming you know the file exists then
lnHandle = fopen(lcMyFileName)
if lnHandle = -1 * -- The file couldn't be opened so is open somewhere else. else fclose(lnHandle) endif
To close it you would have to find the file handle from the other process, i.e. whatever they're using to read PDF files, and use the Windows API to close that handle. Bearing in mind that they could be using any web browser, Acrobat Reader or any number of PDF readers to view the PDF. Maybe extract it in their temp folder and don't worry about erasing it.