Qt: honor requests to close windows made from script