Product uploader fixes

fixes a few serious issues in the product uploader (enumerated in the commits)

reported bug was http://manage.dimagi.com/default.asp?124663 but turns out we also just weren't saving products when they weren't a multiple of 500 (including when there were fewer than 500)