Replace remaining fopen() with fopen_s()

add error handling or at least TODO comments