US markets end a roller coaster session in positive territor