Fixes #1 added missing fclose()