In my experience the voter form can be filled during the ceremony, but it is only filed (put on a box, given to someone) after the ceremony is done. If there has been a problem with the oath you just don't submit the form. If there is a typo on the certificate that shouldn't be a problem, one is still a citizen. Anyway, if one wants to do things by the book, don't sign the form until after the oath is given. There are protections under the law when one has a reasonable expectation of being a citizen, so I would expect that in the worst case if one takes the oath, submits the form, but right after that USCIS says that there was an error and that person shouldn't have taken the oath (anyway, tough luck for USCIS because I think it wouldn't be that easy to reverse that mistake) and that the naturalization was invalid (if that were possible) I think a reasonable judge would see that the person didn't commit a crime as that person had a reasonable expectation of being a citizen.