When packing too many "big" files, packFileEntry' may lead to FD starvation. That's because it uses lazy I/O.
This happened in cabal-install when packing haddock generated documentation: see https://gitlab.haskell.org/ghc/ghc/-/issues/25172#note_630488
How to reproduce
Try to pack N+1 "big" files with ulimit -n N