close() method for disconnection