Fix incomplete decocder output for not flushing the temp file