coded logout sequence for server