Are you working on Pega7? If So, it can be easily done using pzClearRecentItem activity API. You can get list of workthreads and associated entries in recents cache(Declare_pRecentsCache) and call activity on each recent item. At the back it closes all the documents on the client side and clears all work threads on the server.
Or, you could also try to use pzClearAllRecentItems with some wrapper around it.
Can you eloborate more on requirement which may help to look for other possible options.