Remove now-spurious dTHX
No need for automatic contexts in XSUBs
Refactor: Add write/read_header functions
Separate open() from constructor to avoid exceptions in constructor