check for null after _createDocument
fix for #3410 to reconnect agents before reloading the live document in browser