nvenc: flush the encoder before closing it, as required by the docs