Fix eckey_priv_encode to return an error on failure of i2d_ECPrivateKey

eckey_priv_encode does not immediately return an error after a failure
in i2d_ECPrivateKey.