Gold ends at a nearly 2-week high as tensions over North Korea rise