Gold futures end slightly higher, but tally a third straight weekly loss