Typing exit works, but not when the program in the pane is stuck. This closes the pane from the outside.
Ctrl-b x
tmux asks kill-pane X? (y/n). Press y and the pane is gone and the neighbouring panes grow to fill the space. Any other key cancels.
The program in the pane gets a hangup signal. Programs that ignore it can survive, so check with ps if something still needs to be stopped.
The command line version is tmux kill-pane -t 2. Add -a to close every pane in the window except the one you name, which is handy for cleaning up a layout that got out of hand.
Try it safely: start a throwaway session with tmux new -s scratch, run it there, and close the session again with tmux kill-session -t scratch. Nothing else is touched.
Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official)