make couchexport more surgical about not leaving temp files around

handful of semi-related changes to better clean up files.

in response to http://manage.dimagi.com/default.asp?123162 and http://manage.dimagi.com/default.asp?102956