Fixes fopen error check

Returns a pointer, or 0 on failure.