Gold prices end the session lower, but tally a gain for the first half of the year