Correct bug: when closing window, links disapeared (fixes #3944)