Adding clsoe event to windows as well as close animation