public void failWrite(@Nullable FileOutputStream str) {
        if (str != null) {
            sync(str);
            try {
                str.close();
                mBaseName.delete();
                mBackupName.renameTo(mBaseName);
            } catch (IOException e) {
                Log.w("AtomicFile", "failWrite: Got exception:", e);
            }
        }
    }
Call when you have failed for some reason at writing to the stream
returned by {@link #startWrite()}.  This will close the current
write stream, and roll back to the previous state of the file.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/AtomicFile.java