add document listener; close all elems if click outside