add shutdown to connection and a stop method to write queue.