Wall St. ends down; S&P 500 has worst month since 2012