close client functionality