Major stock indexes erased early declines to close higher for a fourth consecutive session Wednesday, shaking off a U.S.