add/remove close buttons where necessary