Fix for BLD-465: e-reader error when popping out window.

[BLD-465](https://edx-wiki.atlassian.net/browse/BLD-465)

**Description of BLD-465**
The attached error is seen when attempting to pop out the e-reader in a different window - happens about 50% of the time. Can be seen in 2.03x here: https://courses.edx.org/courses/MITx/2.03x/3T2013/courseware/Course_Text/Textbook/# . Also noted in 4.605x course.

**Reviewers**
- @singingwolfboy (Python part)
- @jmclaus (JavaScript part) 
- @auraz 

**NOTE**
Original work was going on in https://github.com/edx/edx-platform/pull/1811 . Create a separate PR so as not to block @olmar .