Fix IE10 bug where the document could remain stuck