Put the close socket in the finally clause of the php communicator