Fix error clearing for use_tmp_dh functions

The SSL error is cleared a bit too late in the functions related to use_tmp_dh.

The change addresses for example the case where in use_tmp_dh_file, the call to BIO_new_file fails.