Each product sets its own rule, and the rules are not intuitive. Crude stops trading three business days before the 25th of the month preceding delivery. Grains stop the business day before the 15th of the delivery month. Index futures stop at the open of expiry Friday.
For deliverable contracts the last trading day comes after first-notice-day, so a long holder can already have been assigned delivery while the contract is still quoted.
Example: CLF (January) crude typically stops trading around December 19-20, weeks before January barrels actually flow. A trader who "holds to expiry" without checking is holding a delivery obligation, not a trade.
Related: first-notice-day, final-settlement, delivery-notice, contract-month, roll