Gold ends at 3-month high as dollar wobbles