[WS2_32] Set last error on exit on some functions