use atomic writes to avoid seeing incomplete files (#55424)
### What?
### Why?
multiple ensurePage calls are made concurrently and currently there is a
race condition causing next.js seeing an empty e. g.
middleware-manifest.
### How?
Closes WEB-1577