This switch is not exhaustive, and when it receives an unexpected value it just falls through without writing anything to the file (or closing it). We should probably convert this to the new exhaustive switch syntax with a default block and no "break".