gold ends up, posts a weekly gain of over $27