fix stacktrace when closing container via 'x' in title bar (fix #32)