Gold erases loss to end in positive territory as stocks lose steam