close buton reimplementation