Using try-with-resources to prevent BufferedReader memory leaks.