hlinkdb.py: clean up temp file more carefully
hlinkdb.py: clean up temp file more carefully

Make sure to always close the temp file, and if something goes wrong
while preparing the save, make sure to delete it and remove it from
consideration by commit.

Signed-off-by: Rob Browning <1dc5917c2adeeba13d1ef33dbb40691a1b67cc65@defaultvalue.org>
Tested-by: Rob Browning <1dc5917c2adeeba13d1ef33dbb40691a1b67cc65@defaultvalue.org>

tjanez/bup,tjanez/bup,gevaerts/bup,gevaerts/bup,tjanez/bup,mhoeher/bup,pombredanne/bup,pombredanne/bup,mhoeher/bup,ToxicFrog/bup,jbaber/bup,tjanez/bup,mhoeher/bup,ToxicFrog/bup,gevaerts/bup,ToxicFrog/bup,gevaerts/bup,pombredanne/bup,ToxicFrog/bup,mhoeher/bup,jbaber/bup,pombredanne/bup,tjanez/bup,jbaber/bup,tjanez/bup,mhoeher/bup,pombredanne/bup,jbaber/bup,gevaerts/bup,mhoeher/bup,pombredanne/bup,jbaber/bup,jbaber/bup,ToxicFrog/bup