To square off the open position: - Step-1 ➖ Hover to "Trade" from the top menu bar. Step-2 ➖ Click "Net Position", you can either "square-off" a position or bulk square-off selected/all positions.
To Square off your position, go to the "Portfolio" tab. Click on the open position you want to square off, you'll be given 3 options to select including the "SquareOff" option, simply click on it to close your position.
You can square off your FNO positions before market close on expiry day. In MCX you need to square off your positions one day before the Tender Period T-5. You can check the Tender period of all commodities from the MCX website.