fix write errors after downloading archive files