More closely wrap handle allocs and frees with uv_mutex_lock

This is an ettempt to ensure that we are only blocking when we absolutely
have to. Previously we were blocking during the entire connect proccess.
This may speed some things up or it may break stuff. Revert this commit
if neccessary.
Fix up remainging compiler warnings.