gold ends higher, but suffers longest stretch of monthly declines in more than 5 years