client: fix double-close