Fix prepared statement resource leaks.