Nicer error in gzbinopen
Change dir after reading header
Get back to current dir to write the header