fixed handling clients closing connections