Gold ends higher to halt streak of declines