ex 22.2.3, fixing an fclose call
IO exercises: formatted IO and character IO