Improved Write method performance

Instead of trying to manually populate a metadata store, the
MetadataTools populateMetadata convenience method is now used.

Also added a missing native handshake after reading all bytes.

Also corrected total byte count for partial planes.