Write all the enqueued bytestring before this flush call to disk.
        Block until all the above bytestring are written.

def flush(self):
        '''Write all the enqueued bytestring before this flush call to disk.
        Block until all the above bytestring are written.
        '''
        with self._lock:
            if self._closed:
                raise IOError('Writer is closed')
            self._byte_queue.join()
            self._writer.flush()