Fixed timing issues in the unit tests

There was a lot of race conditions, curl was not sending all the requests to the server, fixed it by adding a couple of calls to `curl_multi_exec`