TS Gateway Fixes

Fix double thread creation in RPC client
Fix leaks and memory issues detected by valgrind
Fix async modes with TS Gateway (false positives in BIO layering)
libwinpr-winsock: add WSASetLastError()