Add a click handler to toggle closing the pane