Closing inventory is the inventory that remains unsold at the year-end so it should be deducted from the total production costs (i.e. cost of goods sold) to get the actual COGS during the year.
Closing inventory in absorption and marginal costings:
1) Absorption costing = (Sales units – Production units) x Total Production costs
(Total Production costs include both variable and fixed costs)
2) Marginal costing = (Sales units – Production units) x Total Production costs
(Total Production costs include variable cost only)