#5 added check that client was closed and could not be used anymore