The built-in defrag tools in Windows are pretty poor at handling advanced defrag duties. 3rd party defrag tools are the way to go, and they typically cost money -- like DiskKeeper and PerfectDisk. Both will handle locked files, either through low-level driver access or by defragging on reboot before Windows loads.
However there are now some freeware tools that improve greatly upon the built-in defragger. I use PerfectDisk so I haven't tried them, and don't know which support defrag-on-reboot or whatever, but they get rave reviews. Try one or both and you'll probably be happy.
http://www.iobit.com/iobitsmartdefrag.html
http://www.auslogics.com/disk-defrag