Gawk has a special section for detecting the EOF for each processed file from command line.
xxxxxxxxxx
awk ' ENDFILE {print FILENAME,"ENDED"} ' file1 file2 file3 file4
# Results
file1 ENDED
file2 ENDED
file3 ENDED
file4 ENDED
https://www.gnu.org/software/gawk/manual/html_node/BEGINFILE_002fENDFILE.html