If the user directly closes the settings window without triggering the
custom command Textfield's onEditingFinished (via unfocus or pressing
enter), the custom command may not save. This change adds a listener to
the Textfield so that if the settings window closes, the change will
always be recorded.