Fix closing a crashed window, closes #269.
Do not receive notifications after window is closed, fixes #265.