Supports booleans in write_array

* Adds support for boolean types to write_array
* Replaces write_bits with write_octet to write booleans to increase clarity
* Adds unit tests against integer and boolean types