Hi,
By setting a rule on the button you can close the form.
1. Go to button properties.
2. Click on Rules.
3. Click Add and then click Add Action.
4. Select close the form in the Action drop down.
Or you can use the following code line to close the form.This should be placed in the button click event.
thisXDocument.View.Window.Close(true);