Do not leave temporary file on update.

Unlink temporary file immediately to guarantee that it will be removed
even if pkg update is terminated by user.
Fix race condition to avoid opening uninitialised variable repofile_unchecked
if `repo.sqlite' file is not in the archive fetched from a mirror.
Merge pull request #476 from vstakhov/master

Do not leave temporary files on update.