Close datepicker on blur + refactoring (cleaner datepicker event handling)