added dispose() instead of setVisible(false)