[Oxygen] Fixes crash when closing window.

This is proper fix for #838