if the system shuts down it tells the apps to "get done with your job". some apps are then trying to "save" something to the disk, e.g. the "last opened document" or "this is the current state of the document the user worked on". don't forget: "services" (or "daemons" in unix-speak) are running in the background and are apps as well. they might want to flush something to the logs.
in addition to that the system has to detach the filesystem from the current session. for some filesystems thats easy (vfat), for some others (ntfs) a lot of magic happens behind the scenes. if the OS does not detach ("umount" in unix-speak) the filesystem properly the filesystem might be marked as dirty OR (even worse) gets corrupted. for that reason the disks are spinned up, the OS writes to the disk and then they are detached.
side note: you can detach a disk from the OS at any time (except the boot-disk) .. then it should stay idle. but if it is idle at the moment you detach it: it will spin up to detach properly, so you are only triggering the shutdown-spinup in advance :) read more about it: