bugfix tds_close_socket undefined
improve performance