fix write close readchan bug