clear writeBuffer in each `drain` + clear writeBuffer after nextTick

This pull request contains new changes for issue #89 and issue #59.