             @scrollTop(@scrollTopBeforeUpdate)
             @scrollLeft(@scrollLeftBeforeUpdate)
             @setCurrentPageNumber()
-            @updating = false
-        , => @updating = false
+            @finishUpdate()
+        , => @finishUpdate()
 
   zoomOut: ->
     @adjustSize(100 / (100 + @scaleFactor))

        @canvases.push(canvas)

      @renderPdf()
    , => @updating = false

  renderPdf: (scrollAfterRender = true) ->
    @centersBetweenPages = []


    atom.views.getView(atom.workspace).dispatchEvent(new Event('pdf-view:current-page-update'));

  finishUpdate: ->
    @updating = false
    if @fileChanged
      @updatePdf()

  updatePdf: ->
    @updating = true
    @fileChanged = false
    @container.find("canvas").remove()
    @canvases = []

