Dear Giancarlo
How many threads are there in that problematic job? Use WRKACTJOB and press F11 twice until your see "Threads" column. Long ending time mostly happens to jobs with many threads. The more threads, the longer it takes.
Did that job show Status other than END during the long ending time?
Have you looked into the job log to see details of what happened after the moment ENDJOB was issued? This may give you clues.
Next thing to check is to run WRKSYSSTS screen and then press F11 to see job transition columns and then keep pressing F10 after you issue ENDJOB to see if you see Wait--> Inel and/or Active --> Inel showing values more than zero or not during the job ending? If you see non-zero values, you may want to increase the Max Active value of the memory pool in which the job runs. Increase by the value of the number of threads that job has. If this is *BASE pool, you should set its Max Active value to at least 1,000.
