Clean up write_header.