is this way of closing a position wrong?

 

I have omitted error handling for brevity. Let's assume there are no error while opening a position. The below code works fine for me.

MqlTradeRequest request;
MqlTradeResult result;
ZeroMemory(request);  // Ensure request structure is clean
ZeroMemory(result);   // Ensure result structure is clean
request.action = TRADE_ACTION_DEAL;
request.symbol = _Symbol;
request.volume = lotSize;
request.type = ORDER_TYPE_BUY;
request.type_filling = ORDER_FILLING_IOC;
request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK); // Use Ask price
request.sl = 0;
request.tp = 0;
request.magic = magicNumber;
request.deviation = slippage;
request.comment = "No wick bullish candle";
// Send the trade request
iOrderSend(request, result);

When I try to close the same position using the below code, another SELL trade gets opened. Why?

MqlTradeRequest closeRequest;
MqlTradeResult closeResult;
ZeroMemory(closeRequest);
ZeroMemory(closeResult);
closeRequest.action = TRADE_ACTION_DEAL;
closeRequest.position = tradeTicket; // Reference the open position
closeRequest.symbol = _Symbol;
closeRequest.volume = lotSize;  // Same volume as the open order
closeRequest.type = ORDER_TYPE_SELL; // Close the buy position with a sell order
closeRequest.type_filling = ORDER_FILLING_IOC;
closeRequest.deviation = slippage;
// Send the close request
OrderSend(closeRequest, closeResult);

if this is not the correct wat, then what is it?