Use the 'Close_record' method for the object you are viewing with the form.