Flush channel.write on error handler