writing bits to compressed file