Changed so that a package index file will always exist even if the script crashes