only fopen file if stat succeeded