JavaFX - fix closing