cabinet: Rewrite the cabinet header output code, and write everything to disk in...