catch CaseError when downloading a form

http://manage.dimagi.com/default.asp?81399#470677

This bug does not appear in production anymore, but I've included a fix anyways.