gold recovers from a three-week low to end slightly higher