I also have Win98se and had that problem for the longest time but mine was random. It used to hang more than it would shut down and I never really found the problem but I think it was caused from remnants of my previous anti-virus software not being completely removed. You might want to make sure if you were using another program that it is completely removed from your registry.
A few months ago, I reformatted my drive and had to re-install Win98se for other reasons, but since then I have installed Avast and have never had that problem since.
Some other causes could be Win98se APM power management settings. I also read that some 3rd party screen savers or device drivers can effect shutdown. Have you installed any other software before the problem started or changed your power management settings? I also set my Bios settings to never go into standby mode but sleep mode only. Standbye mode with Win98se seems to cause problems also. If my PC was in standbye for say 2 hrs, my system clock would be 2 hrs behind and my PC would run really slow. I set my Bios to go into sleep mode only and not standbye.
These are only some suggestions and I know how frustrating it can get because I went through the same thing. Just don't give up and remove Avast. It is well worth keeping and just hang in there and try to fix the shut down problem.