call fdopen() after FileFd was checked
apt-pkg/indexcopy.cc: check for pending errors before calling fdopen()
fix resource leak when verification fails
delete targets data
fix potential GetLock() fd leak
add missing "free(buffer) for allocated buffer