Fixed many unused vars, includes, fixed non closed file streams, fixed
static value access
Fixed too early close
Merge pull request #327 from wmchris/master

See Commit