Prepared Statement entry not being purged with schema error

This PR adds the test case to validate the bug mentioned in issue #227