Gold ends higher as dollar extends weakness