Fix not setting filter correctly for to-memory ArchiveWriter
Fewer C-style casts
Test read/write to files directly and to memory