gold ends lower, but gains on the week