add write.close()

modify write.Stop(), messageRouter()'s logic