replace writer.Close() with write.close()

1. re-setting this.exitChan in writer.close()
2. replace Mutex with transactionStat