fix issue #474

add test "exc is None" to avoid overwriting first OSError with a second one

Suggestion from http://www.jmodelica.org/4688#comment-2154