Fixed bug in writer at block flush due to bad compression bit

When writing events, a scope issue caused us to sometimes indicate
that a block was compressed when it wasn't. This caused the reader
to run decompression on the data and munge the output. Fixed by
altering the scope of the compression bit, and added unit test