client: fix various use after close