If generating a bin file (second half of conditional), make sure the file is closed
(Also fix spelling in comment)
Merge pull request #464 from asmaloney:missing_fclose