avoid race conditions when saving layers CDB-994