Gold ends at a 1-month high as traders shy away from risky assets