Close connection upon logout