Add "droonga-engine-modify-catalog" command
Extract logic to write a file safely