write document and renew meta files