Changed the scanner to be local and calling the closing scanner method.