Added finally block to make sure we close our Scanner (and the underlying stream) even if there is an exception