freeze

Commits final byte[], trimming it if necessary and if trim=true