Just for information:-
I am using an ESP32 with Arduino IDE.
I have noticed that if the board selected, is 'Arduino Pro or Pro mini', the ESP32 reboots when the monitoring window is closed.
Opening a monitoring window, does not cause a reboot.
If the correct 'ESP32 Dev' board is selected, no ESP32 reboot occurs when opening or closing the monitoring window.
(ESP32 does reboot after a program download, as expected).
On both:-
IDE 1.8.12 running on Windows 10
IDE 1.8.15 running on Windows 7
Maybe this could be (added/is) a selectable option?