Prevent rendering when closing lightbox (bug 979506)

Continued from #396. https://bugzilla.mozilla.org/show_bug.cgi?id=979506

@cvan found a bug that caused the history to not be removed. This fixes that bug and also prevents the scroll-to-top by preventing the render instead of resetting the scroll position.