title: JavaFX closing application modal dialog
body: <p>I'm using <a href="https://stackoverflow.com/questions/14168064/how-to-create-a-javafx-dialog">this</a> example to create application modal dialog. When I click exit button on my dialog (red one in top right corner) everything works fine. Dialog gets closed and then I can open it normaly. But when I try to add a <code>Button</code> which closes my dialog, everything works fine until I try to reopen it. After that, it throws me a <code>IllegalStateException</code> (I'll update answer with this exception if needed).</p>
  
  <p>This is an event handler which demonstrates how I close a dialog:</p>
  
  <pre><code>    btnClose.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
          @Override
          public void handle(ActionEvent event) {
              dialog.close();
          }
      });
  </code></pre>
  
  <p>Can someone tell me how to properly close application modal dialog? Thanks in advance.</p>