Refactor and close button signal