Bug fix: close the windows when Xed