close connection after producing a message