You can use the clearFocus method of FocusController to clear the focus and close the soft keyboard. The sample code is as follows:
this.getUIContext().getFocusController().clearFocus()