add options listener and closing on outside click