add click function for terminal close