Writes a byte buffer to the underlying output file.
        Raise exception when file is already closed.

def write(self, byte):
        """
        Writes a byte buffer to the underlying output file.
        Raise exception when file is already closed.
        """
        if self.is_closed_flag:
            raise Exception("Unable to write - already closed!")
        self.written += len(byte)
        self.file.write(byte)