Used 'with' statement for socket lock

We were using a try...finally.