Added a flush method to write any remaining bits into the byte stream