Gold settles higher, notches best weekly gain since June