Temporary `.bib` file causes pandoc error 99 when rendering on Windows

I'm getting a pandoc error 99 while rendering a temporary .Rmd file that uses a temporary .bib.

Here's a reproducible example tested on Windows 10. The same code works on macOS.

local({
  dir <- withr::local_tempdir()
  bib <- withr::local_tempfile(lines = "", fileext = ".bib", tmpdir = dir)
  
  lines <- "---\nbibliography: %s\n---\nsuccess\n"
  lines <- sprintf(lines, bib)
  
  rmd <- withr::local_tempfile(lines = lines, fileext = ".Rmd", tmpdir = dir)
  
  print(bib)
  
  rmarkdown::render(input = rmd, output_format = "md_document", quiet = TRUE)
})

#> [1] "C:\\Users\\arangaca\\AppData\\Local\\Temp\\RtmpsJRMb3\\file1bf847671b3\\file1bf85b2b3b6a.bib"

#> File C:1bf847671b31bf85b2b3b6a.bib not found in resource path
#> Erreur : pandoc document conversion failed with error 99

I'm not sure to understand why it's looking for a file called C:1bf847671b31bf85b2b3b6a.bib.

Any idea how to fix it?