How does zerodha close a trade when there is no liquidity

Depends on which option you are holding. Index options expiring ITM are settled by the exchange at the intrinsic value.

If it’s stock option, you will have to give/take delivery of underlying shares if option is ITM.

Have explained this here: What happens if I don't square off my positions in options? - #2 by ShubhS9