Fix segfault on forcible window closure.