When you receive the message 'The document is already locked..".
To resolve this problem is create an Agent with the following code:
FIELD $Writers := @DeleteField;
FIELD $WritersDate := @DeleteField;
While Not(entry Is Nothing)
Set doc = entry.Document
doc.UnLock
Wend