Do not consider a statement as prepared if it errors

Fixes #600
Merge pull request #661 from brianc/issues/600

Do not consider a statement as prepared if it errors