Close Scanner instances

Not closing Scanner becomes warning in JDK7. This change is made so that there
will be less warnings to deal with if and when the compiler is switched to
JDK7 in the future.