Panel close button, slight refactoring