Preparation of carboxylic acids or their salts, halides or anhydrides by oxidation with sulfur or sulfur-containing compounds