Fix buffer underflow on socket close

patch by yukim; reviewed by jbellis for CASSANDRA-5792