Multiple Resource leaks fixed

Missing fcloses all around project. Mostly forgetten before return
statements.