Write/Rename to prevent corruption on crash