Add friendly error
Add missing fclose