Gold ends at multiweek high after back-to-back advance