added action listener for dialog buttons. Dialogs now close when button
pressed.