And if you are fired, file at once for your unemployment benefits. If it was not a deliberate mistake, and it did not bring you any profits, of course it was not misconduct. (This assumes, of course that in order to do this, you did not fail to follow legitimate company procedures, that might be misconduct, such as a safety violation, checking off violation, or something of this type.)
Though it may have cost the company quite a bit of money, it still was not deliberate wrongdoing on your part, and you probably will be determined to be eligible for benefits if they fire you. (This is also assuming you have not made errors of this type many times in the past and been written up or disciplined for them in some way.)
Whatever you do, do not sign anything admitting wrongdoing of any kind, and do not agree to "resign in lieu of being terminated" or some such drivel as that. If the company fires you, they have to prove they had a good misconduct reason to fire you, or you will be eligible for unemployment benefits. If you agree to resign "to protect your reference" or something, then you probably won't be able to draw unemployment benefits because you left of your own choice. Don't let them pull this one on you. Even if they threaten to prosecute if you don't resign, as pattytx has pointed out, they'd probably never be able to get up a case on this.
In my days of working with unemployment, I have seen many cases of employee error which ended up costing the company money. It is still not something the employer can kill the person for, or have them drawn and quartered for. Wrecking the company truck, tearing up a piece of expensive equipment, misbilling, if it was an accident...i or a mistake it was NOT an "I meant to do it" and there's no sense beating yourself up over it any more.