cleanup archive extraction
Fixup windows build
switch over to more robust write function