fix: handle eof properly if encoder is idle