This is different from commodity futures, because commodity futures have physical delivery, so the last trading day is different from the delivery date, and the delivery date will be a few days later.
The delivery of stock index futures is based on the difference between the "price" of your futures contract and the actual "price" of the current spot market, which is equivalent to closing the position at the spot "price" on the delivery date. Stock index futures are delivered in cash.