First, install all available Windows updates and run the Windows Update troubleshooter under Settings > System > Troubleshoot > Other troubleshooters > Windows Update > Run. Microsoft also recommends repairing Windows components by opening Command Prompt as administrator and running
DISM.exe /Online /Cleanup-image /Restorehealth
Followed by
sfc /scannow.
If the delay continues, temporarily return the CPU and graphics card to their default settings and perform a clean boot to determine whether an overclocking utility, monitoring program, antivirus, driver, or other third-party service is preventing Windows from shutting down normally.
https://support.microsoft.com/windows/experience/startup-boot/how-to-perform-a-clean-boot-in-windows
Also check Event Viewer > Applications and Services Logs > Microsoft > Windows > Diagnostics-Performance > Operational for events 200 and 203 recorded at the time of shutdown.
Please share the results from DISM and SFC, and the details of any relevant Event 200 or 203.