 All three major indices posted gains for the week in a broad-based rally. At the closing bell, the Dow gained 247 points and will start the day and week exactly at 40,000. S&P 500 rose 30 to 5615, and the Nasdaq climbed 115 points to 18,398.