Right way to close orders ?


Ok so my question is a bit nooby because i got no experience in real trading

My idea is that if I receive a close signal, and send a close order, there is maybe an exception when the order isn't closed because of slippage?

If so my idea was to use a buffer that I set to 1 when I want to close an order, then check the number of Positions every tick, and if the number is positive, send another close order and so on, until the number of positions is 0 then I reset the buffer number to 0.

is that the right way to close orders ? Or am i thinkking it too deeply and sending a single close order is enough and will be processed anyway ?

thanks so much