The compressor has a problem with a possibly pending 0-sequence at the end of the file, because your program outputs the 0-sequences only on changes, that is when meets a non-zero character. You have to check for a pending 0-sequence immediately after execution of the for loop:
if(stanje != 0)
{
fputc(0x00, izlaz);
fwrite(&brojac, sizeof(int),1,izlaz);
}