Thanks Yutaka for checking the code. I understand that this comes from the original design and that many users are used to such behavior, but still, it looks really awkward. In fact, if I modify the settings of the serial port that is currently in use by another application and click OK, Tera Term even shows the error:
And then user can only guess whether the change of settings was accepted or failed.
If it is not very difficult, to keep backward compatibility, I'd suggest adding configuration option (checkbox) allowing to change this behavior with default setting as it is right now. If this is too much hassle, than please update Serial port ([Setup] menu)
page in Tera Term help file and add a Note saying that
As soon as you will click OK in this window Tera Term will try to open serial connection on currently selected serial port. The error message may pop up if selected port is in use by another application. This error message should be ignored.