diff --git a/cluster/shard_writer.go b/cluster/shard_writer.go
index <HASH>..<HASH> 100644
--- a/cluster/shard_writer.go
+++ b/cluster/shard_writer.go
@@ -43,7 +43,9 @@ func (w *ShardWriter) WriteShard(shardID, ownerID uint64, points []tsdb.Point) e
 	if !ok {
 		panic("wrong connection type")
 	}
-	defer conn.Close() // return to pool
+	defer func(conn net.Conn) {
+		conn.Close() // return to pool
+	}(conn)
 
 	// Build write request.
 	var request WriteShardRequest
Ensure unusable connections get closed

Fixes a bug where a connection that was marked as unusable didn't
prevent it from getting checked backed into the pool.