'Writes file footer (finishes the file).'

def WriteFileFooter(self):

    if (self.cur_file_size != self.cur_info.size):
        raise IOError(('Incorrect    file    size:    st_size=%d,    but    written    %d    bytes.' % (self.cur_info.size, self.cur_file_size)))
    (blocks, remainder) = divmod(self.cur_file_size, tarfile.BLOCKSIZE)
    if (remainder > 0):
        self._tar_fd.fileobj.write((tarfile.NUL * (tarfile.BLOCKSIZE - remainder)))
        blocks += 1
    self._tar_fd.offset += (blocks * tarfile.BLOCKSIZE)
    self._ResetState()
    return self._stream.GetValueAndReset()
