buffer: introduce Buffer#toArrayBuffer() API

This also includes a few small fixes.