Fix a segfault issue

Do not ignore fopen return value any more.