core: fix concatenating certain combined file streams.

(cherry picked from commit 4c1a31b96ed092726257975a4450c064b0a18128)