fix; do not write logs if client is closed