### Bug description

TLDR; CairoMakie figures render fine on first render. Subsequent renders produce empty figure-pdf files causing LaTeX compilation failures.

Consider the following example

````md
---
title: hello world
jupyter: julia-1.8
---

```{julia}
using CairoMakie
lines(-2..2, sin )
```
````

When you first call `quarto render main.qmd --to pdf` everything renders without issue with the following output

```
Starting julia-1.8 kernel...Done

Executing 'main.ipynb'
  Cell 1/1...Done

pandoc 
  to: latex
  output-file: main.tex
  standalone: true
  pdf-engine: xelatex
  variables:
    graphics: true
    tables: true
  default-image-extension: pdf
  
metadata
  documentclass: scrartcl
  classoption:
    - DIV=11
    - numbers=noendperiod
  papersize: letter
  header-includes:
    - '\KOMAoption{captions}{tableheading}'
  block-headings: true
  title: hello world
  jupyter: julia-1.8
  
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
running xelatex - 2
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  

Output created: main.pdf
```

However if you call the same render command again I get 
```
...
running xelatex - 1
  This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022) (preloaded format=xelatex)
   restricted \write18 enabled.
  entering extended mode
  
updating tlmgr

updating existing packages

compilation failed- error
Unable to load picture or PDF file 'main_files/figure-pdf/cell-2-output-1.pdf'.
<to be read again> 
                   }
l.203 ...ain_files/figure-pdf/cell-2-output-1.pdf}                                                  
```

Looking at `cell-2-output-1.pdf` I see that it is an empty 0kb file. If I force `--execute-daemon-restart` everything will then render fine. 

I checked this against a notebook with just

```julia
using IJulia, CairoMakie
IJulia.register_mime(MIME("application/pdf"))
CairoMakie.activate!(type = "pdf")
lines(-2..2, sin)
```

and reevaluating the notebook file seems to generate the correct outputs. So, I don't think the issue is on the IJulia/CairoMakie side of things. 

- Debian 11
- Quarto v1.3.34
- CairoMakie v0.9.3
- IJulia v1.23.3


### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
2022-12-05T22:33:35Z
agerlach
bug julia
v1.3
closed
CairoMakie Subsequent Renders Produce Empty Figure Files
https://github.com/quarto-dev/quarto-cli/issues/3574