Hi Neil
When you close a connection it also needs the peer to acknowledge the close (the peer may still have data to send and may want to complete this first) and so it may not be immediate. I would look at the close phase using WireShark so that you see exactly what it is doing.
A reset means that the peer sent a TCP RST. Exactly why is possibly visible from the recording. It may be due to an error while closing but it may be something that the TCP stack on the PC does as standard.
If you only have one socket you need to wait for it's connection to close before starting a new connection. This will usually be informed by the TCP_EVENT_CLOSED event, but the TCP_EVENT_ABORT is handled equivalently [the TCP_EVENT_CLOSED is the textbook case, whereas the TCP_EVENT_ABORT is possibly more an error case].
Regards
Mark