Code "soft bricks" my board

Aha. Hm .... Mr. spock would say

The messages claim uploading was successful but the serial-monitor can't be opened.
What does the device-manager of your computer say?
Is Com24 listed in the devicemanager?
If you close the serial monitor and re-open the serial-monitor and then press the reset-button of the device what does happen?

close the serial-monitor of the Arduino-IDE.
unplug and re-plug the board
Open some other serial terminal-program on the comport shown in the device-manager

does this other serial terminal show anything received?

best regards Stefan