Move close box into the popup code