CLN: remove unnecessary close calls and add a few necessary ones
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Follow up to #37639. Close file handles as early as possible.

Remove `close` calls that are already within a try-except/finally block that closes the file handles.

Add `close` call for `read_json` when we read the entire content in one go.

Add close call in `read_csv` when reaching the end of the iterator.

Put `to/read_excel` in a try-finally block to make sure that file handles are closed even in case of an exception.