fix(system): write all files atomically