Stocks closed lower in New York today as markets followed what has become a pattern at the sputtering end of this fourth-quarter rally: Early gains narrow through the day’s trading and occasionally turn to losses. The major indexes finished the week mixed.