All three major stock indexes closed dismal worst quarters on Friday, erasing much of the gains from the first half as investors snapped out of their growth-friendly sentiments fueled by artificial intelligence daydreams and paid heed to a litany of potentially worrisome macroeconomic conditions.