As a follow up to the earlier posts in this thread...
I tried the various suggestions, with thanks. Unfortunately none of them would clear what ever it was preventing my computer from going to sleep. However, a couple of days ago I had a whole bunch of updates from Windows which I duly installed. Ever since then, the computer goes to sleep as instructed. Just like it used to many months ago before the problem started.
I have no idea which update altered the problem, but it now works.
Thanks again to those that provided ideas.