fixed previous bug with loops and deferreds, styling closebutton