I am calling some awk code in a R script using system(). The awk works wonderfully and very quickly and grabs some text from a text file on a disk, and creates two new files on the disk and redirects some of the text into them (I call awk as it is super fast for wrangling 20+ Gb size files). The two files are meant to exist only ephemerally until their contents have been read into R variable using vroom() in the same R code. However, these two newly created files cannot deleted either by using system(paste("rm", shQuote(file))) in the R code, close(file) within the awk code, or by selecting and hitting delete in a Windows File explorer. In the latter case, the title error appears in a Windows dialogue window. The two files can be opened eg by Wordpad, but not edited, nor they can be renamed. The only way I have found to help is to restart Rstudio and the files can be then deleted manually. Also, if the files are still present on the disk (ie, I haven't restarted Rstudio and deleted them), the R script halts at awk call because awk can't create them either as they already exist. So, how to either avoid this situation in the first place. I have used awk in R/Rstudio before in similar scenarios without problems, and this is a new kind of problem for me...