The three major stock indexes wobbled between red and green for much of the session, but all three managed to flip green in the closing minutes.