unnamed-chunk errors

I have a recurring issue with in my notebooks which I think is related to caching. It happens with some regularity that code blocks which ran fine previously start to throw errors, of the sort:

Quitting from lines 51-52 [unnamed-chunk-9] (02-geographic-data-in-r-messin.Rmd)

or

Warning in gzfile(file, "wb") : cannot open compressed file '/home/biscotty/Learning/R/GeoSpatial/geocompx/.Rproj.user/shared/notebooks/911595BD-02-geographic-data-in-r-messin/1/A00762A5B5B75CD0/cv5dy0gdf24s9_t/ef59ef0a3b2543d78d4265797550942d.snapshot', probable reason 'No such file or directory' Error in gzfile(file, "wb") : cannot open the connection

If I open a new code block below the command which produced the second error and repeat the exact command it runs normally. The problem seems to be related to graphics/plotting and occurs if I make a change to a code block having run it once. There seems to be some caching going on, which I'd like to turn off, since I end up doing a lot of copy/paste to make minor modifications to a code block.

Thanks in advance

FWIW If I remove the front matter it seems to go away, and I can knit manually, so I think it is a knitr error at some level.

EDITS:
On further testing, this seems to happen with any alteration to a chunk of code already run.

On yet further testing, this seems to only happen when editing in Visual mode. I started using Source mode and haven't had any issues (so far).

Here's an example. I try to run this code (requires tmap, see source) in a notebook.

ma1 = tm_shape(nz) + tm_polygons(fill = "red")
ma2 = tm_shape(nz) + tm_polygons(fill = "red", fill_alpha = 0.3)
ma3 = tm_shape(nz) + tm_polygons(col = "blue")
ma4 = tm_shape(nz) + tm_polygons(lwd = 3)
ma5 = tm_shape(nz) + tm_polygons(lty = 2)
ma6 = tm_shape(nz) + tm_polygons(fill = "red", fill_alpha = 0.3,
                                 col = "blue", lwd = 3, lty = 2)
tmap_arrange(ma1, ma2, ma3, ma4, ma5, ma6)

And get this error:

Error in grid.newpage() : 
  could not open file '/home/biscotty/Learning/R/GeoSpatial/geocompx/.Rproj.user/shared/notebooks/7BF468A6-09-making-maps-with-r/1/A00762A521583894/c0g891mdi0zej_t/_rs_chunk_plot_001.png'

If I restart R, it runs without error. The problem is that this happens so frequently that it becomes a pita and I find myself using vscode even though I really, really like the rstudio ide.