fix #78

A few places the files were open but not closed
grid, missing var check, getting var.
This seems to fix the issue.
@gleckler1 parmeters file runs fine with a ulimit of 50 (vs the default of 1024 that failed before)