Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't
write complete output on close.