Gold settles slightly lower as U.S. stock market hovers near records