Why are there two closeButtons in this method?