24bit Write

Added support for a 24bit file write.

Also fixed a crash issue I was having with reading slightly malformed file with more data in the last chunk (1 more byte than it should have).