properly close when downloading an archive