Only write the sorted file if it will not clobber anything.