Closes #19839: Fix regression in bz2 module's handling of non-bzip2 data at EOF.

Also fix an analogous bug (not a regression) in the lzma module.