Fix preprocessing for `--text_file` option.
# What does this PR do ?

- Currently, the `--text_file` option always looks for .json files, so I've fixed it to look for .txt files.

**Collection**: [NLP]

# Changelog 
- If you use the `--text_file` option, it will look for .txt files.
- Fix bug opening invalid file instead of `json_file`.

# Usage
You can run the preprocessing task as follows:

```python
python NeMo/scripts/nlp_language_modeling/preprocess_data_for_megatron.py \
--input=/datas/raw/ebooks \
--text_file \
--preproc-folder \
--tokenizer-library=huggingface \
--tokenizer-type=/gpt2_bpe_tokenizer \
--merge-file=/gpt2_bpe_tokenizer/merges.txt \
--vocab-file=/gpt2_bpe_tokenizer/vocab.json \
--dataset-impl mmap \
--append-eod \
--output-prefix=hfbpe_gpt_training_data \
--workers=64
```

# Before your PR is "Ready for review"
**Pre checks**:
- [x] Make sure you read and followed [Contributor guidelines](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md)
- [ ] Did you write any new necessary tests?
- [ ] Did you add or update any necessary documentation?
- [ ] Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
  - [ ] Reviewer: Does the PR have correct import guards for all optional libraries?
  
**PR Type**:
- [ ] New Feature
- [x] Bugfix
- [ ] Documentation

If you haven't finished some of the above items you can still open "Draft" PR.


## Who can review?

Anyone in the community is free to review the PR once the checks have passed. 
[Contributor guidelines](https://github.com/NVIDIA/NeMo/blob/main/CONTRIBUTING.md) contains specific people who can review PRs to various areas.

# Additional Information
* Related to # (issue)
