Make windows closes properly when screw up.