Fix building under ARC
Only remove document backup if writing failed