Fall back to open/write when atomic_write fails

Fixes #28190.