better closing of widget when clicking outside of it