my update: i uninstalled avira, but the problem continued.
There are some people here that should eat their words after this.

Avira made one of the best antivirus software and I'm glad so many choose it.
king44 and the others, you cannot advise users to find alternatives based upon your unrelated issues. Have you used the full suite with Firewall? Did you add the network paths to the exception list in AV? ...etc.
On topic:
Software configuration may be the culprit, but we need to know more about it, or else people will start bashing the only piece of software you have mentioned, Avira.
How do you shutdown your laptop, using the start menu, Alt+F4, power button on the laptop? What power plan do you use and what function is assigned to the power button (
CP -> Power Options)?
Does
Sleep function works? I mean, is the laptop powering down everything, dead silent and cool? Can it be resumed directly to Windows? How about doing this correctly after a few hours of
Sleep? If that works ok, why are you even using
Shutdown and not
Sleep?
Get Autoruns from Microsoft. Launch it, go to
Options, check only
Verify Code Signatures.
User -> Select the first user.
File ->
Refresh F5. After the scan is finished,
File -> Export as Ctr+A, name it as the username (i.e system;service;network). Do this again for all the users. Add those txt files to a zip and post it here.
Launch
Event Viewer. Go to
Applications and Services Logs -> Microsoft -> Windows -> Diagnostics-Performance -> Operational. Right click it and choose
Save All Events As, name it, zip it, post it here.
Still in
Event Viewer, go to
Action -> Create Custom View. At
Filter:
Logged=Any time
Event level=Error
By log=Windows logs\System
<All Event Ids>=6008
Leave the rest, press
OK, name it as
Shutdown problem or whatever. You will get a list of events. On my system I have only 7 of those, and it's normal, I sometimes pull the plug on the power line forgetting to shutdown the PC. If you have lots of them, it could point to a hardware issue. Since you don't get any random reboots (do you?!) we can rule out a faulty circuit board and that leaves the bios as a possible culprit.
It seems that
WaitToKillServiceTimeout 20000 had some limited success.
You should try these (test with AutoEndTasks on 1, too):
[HKEY_CURRENT_USER\Control Panel\Desktop]
"AutoEndTasks"="0"
"WaitToKillAppTimeout"="15000"
"HungAppTimeout"="15000"
If those are not helpfull, there is no point to delay the shutdown, so put KillService on 10000 , Auto on 1, KillApp on 5000 and HungApp to 10000.