It is not recommended to call API that allocates/release context and connects/disconnects devices several times in a short time. 

Some users would call BS2_AllocateContext, BS2_Initialize, and BS2_ReleaseContext, and unloading the library pretty frequently after loading the library. 
When the actual device connection is finished after the Initialization step, command processing by the user is performed but also and it keeps track of "keep-alive" or processing log internally and invisibly. 
Basically, socket communication is not terminated immediately but it is after finishing all works in process, which is called 'Graceful Shutdown' that can generate TIME_WAIT. 
The counts the frequency might be different depending on the Windows version since Win socket library version is different for each Windows version.
In conclusion, we do not recommend calling allocating/releasing context or connecting/disconnecting device API several times in a short time, but please call them just once in service in the very beginning of the service, and before exiting the service at last.