The benchmark S&P 500 and the blue-chip Dow rose in choppy trading on Friday, aided by expectations for an imminent end to the Middle East conflict, while SpaceX shares surged in their debut, making it Wall Street’s biggest public listing in history.