Fix header generation not working on mac because of fopen a+ differences