atomically_replaced_file: ensure error leaves original

Make sure an exception inside the body leaves the original file
content.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>