Duplicate layer on the top of layers on all open documents
I tried to duplicate some layer with a script to all open documents and put that layer on the top (with script listed below), but problem occures when on another document, active layer have cliped layers, this script unclipe layer. Does anyone now how to improve this?

if( app.documents.length > 0 ){
duplicateToAll();
}
function duplicateToAll(){
docs = app.documents;
curDoc = app.activeDocument;
for(var i = 0; i < docs.length; i++){
if(curDoc != docs[i]){
var curLayer;
try { curLayer = docs[i].activeLayer; } catch(e) {}
curDoc.activeLayer.duplicate(docs[i],ElementPlacement.PLACEATBEGINNING);
}
app.activeDocument = curDoc;
}
}