[NRY] Buffer.prototype.write encoding fixes

Fixes #690 and some other write method parameter handling.