Wall Street’s worst month in three years ends on a sour note