hlsenc: Append the last incomplete segment when closing the output