Fix exception catch order to improve portability

std::ios_base::failure inherits:

* C++98: std::exception
* C++11: std::system_error, which inherits std::runtime_error

so, when using C++11, it generates compiler warnings, because std::runtime_error is catched before std::ios_base::failure inherits.

I reordered the exception catch clause to improve portability at no cost.