The energy and technology sectors did well in August, while Moderna’s stock was the best performer by a wide margin.