Strange behaviour when writing/reading from a txt file in Java

I am writing a GUI for a minesweeper and I am saving the difficulty in a text file. However instead of writing to file the difficulty properly, it always empties the file and my null check condition is triggered.

I have tried using debugging and manually editing the text file to contain the string "HARD", but after changing the difficulty (setting it again to hard, or switching to easy), the file becomes empty.

public class MineSweeperMain extends Application {

    public static void main(String[] args) {
        launch(args);
    }
    @Override
    public void start(Stage primaryStage) throws Exception {
        String difficulty;
        BufferedReader br = null;
        try {
            br = new BufferedReader(new FileReader("LastProgramState.txt"));
            difficulty = br.readLine();
            if (difficulty == null) {
                System.out.println("???");
                throw new FileNotFoundException(); // If I comment this out, file becomes empty
            }
        } catch (FileNotFoundException e) {
            BufferedWriter bw = new BufferedWriter(new FileWriter("LastProgramState.txt"));
            bw.write("EASY");
            bw.close();
            difficulty = "EASY";
        } finally {
        if (br != null)
        br.close();
        }

        int xSize;
        int ySize;
        int bombCount;
        System.out.println(difficulty);
        if (difficulty == null) {
            System.exit(200);
        }
        if (difficulty.equals("HARD")) {
            xSize = 16;
            ySize = 16;
            bombCount = 40;
        }
        else {
            xSize = 9;
            ySize = 9;
            bombCount = 10;
        }
            Menu menu1 = new Menu("Options");
            Menu menu2 = new Menu("Help");
            MenuItem mi1 = new MenuItem("Difficulty: Easy");
            MenuItem mi2 = new MenuItem("Difficulty: Hard");
            MenuItem mi3 = new MenuItem("How to play");
            MenuItem mi4 = new MenuItem("About...");
            menu1.getItems().add(mi1);
            menu1.getItems().add(mi2);
            menu2.getItems().add(mi3);
            menu2.getItems().add(mi4);

            MenuBar bar = new MenuBar();
            bar.getMenus().addAll(menu1,menu2);
            Label score = new Label("Score:");
            Scene scene = new Scene(bp);
            primaryStage.setScene(scene);
            primaryStage.setTitle("MineSweeper");

            primaryStage.show();
}
            mi1.setOnAction(event -> { //EASY
            try {
                BufferedWriter bwriter = new BufferedWriter(new FileWriter("LastProgramState.txt"));
                bwriter.write("EASY");
            } catch (IOException e) {
                System.exit(100);
            }
                primaryStage.close();
                Platform.runLater( () -> { //RUN APPLICATION AGAIN
                    try {
                        new MineSweeperMain().start( new Stage() );
                    } catch (Exception ex) {
                        System.exit(100);
                    }
                } );
            });
            mi2.setOnAction(event -> { //HARD
            try {
                BufferedWriter bwriter = new BufferedWriter(new FileWriter("LastProgramState.txt"));
                bwriter.write("HARD");
            } catch (IOException e) {
                System.exit(100);
            }
                primaryStage.close();
                Platform.runLater( () -> {
                    try {
                        new MineSweeperMain().start( new Stage() );
                    } catch (Exception ex) {
                        System.exit(100);
                    }
                } );
            });
}

If I choose hard difficulty, I expect the txt file to contain the string "HARD", but instead it contains the string "EASY". The same behaviour occurs when I choose easy difficulty. Also I noticed that if I remove the throw new FileNotFoundException(), the file becomes completely empty. What am I doing wrong? Any help is appreciated.

EDIT: Issue solved, I forgot to close the file after writing to in in mi1.setOnAction() and mi2.setOnAction().