Add an option to avoid writing empty result file