We are working on a solution for this now. (QAT-11935) It is being a bit persnickety but we might have a fix in next Beta (two weeks from now).
We normally close the connection associated to the activity but in the case of XQuery we do not. Even that is not normally a problem unless Excel is involved and that file is made within the script and then used.
Even though we are “connecting” to excel like it is a database is it not really and does not support concurrency, etc. So what you would expect in normal database is not available. As an immediate work around I would export the data to Local Storage (If you have pro edition) or Toad Sample Database (bundled access database with Base edition). Both Local Storage and Access are real databases and should give you what you want for use in XQuery.
Otherwise wait a couple of weeks and see if we got this fixes. (I am hopeful)