The STATUS(3) will return a 1 when a connection has been made. So if the network is busy or network latency is high it may take a little longer to return a 1. You should wait for STATUS(3) to return a 1 before sending READMODBUS/WRITEMODBUS etc commands.
When you close a socket, there is a bit of house keeping that the network stack need to do to fully close the socket. Only when the socket is fully closed then STATUS(3) returns a zero.
If you do a round-robin connection to each slave quickly then managing the network connection and disconnection is important, otherwise you may encounter situation where the next connection will fail because the last connection is still open.
Attached sample program "ModbusTCPTest.PC6" file is a good example to follow to prevent your program from getting stuck in inability to close a previous connection properly before making a new connection.