Do not consider a statement as prepared if it errors

Fixes #600