Use close_conn(ctx, client) instead of client.Close()

client.Close() doesn't dispatch any event, nor allows some kind of teardown procedure when a client is disconnected. Use close_conn(ctx, client) instead.