Implement per-window closing.