fixed date picker issue when dismissing the date layout and also added autoclose feature