Stocks fluctuated over the course of the trading day on Thursday but managed to end the session mostly higher ahead of the long holiday weekend. The gains on the day partly offset the losses posted in the two previous sessions.