Nasdaq notches second-best close as tech groups advance