Save files atomically