Major stock indexes erased early declines to close higher for a fourth consecutive session Wednesday, shaking off a U.S. government shutdown and a surprising decrease in private-sector jobs.