Denis,
If you are quiting, and that is what ON SHUTDOWN does, why do you need to CLEAR ALL before you QUIT? I think you can simply remove the clear all line.
The reason you are getting this is because some object is active when the ON SHUTDOWN gets called. When the QUIT is hit the objects will be released but before that they exist and are active. VFP cannot clear an object that is active with the CLEAR command.