properly close the archive