Improve use of ByteSource with test resources

This commit ensures proper resource cleanup, simplifies
initialization, and paves the way for purely synthetic inputs in a
subsequent commit.