Dialog widget close problem

Dialog widget close problem

I am using backbone view to handle the opening and closing of the dialog widget.
I have written a function that performs a specific task when the dialog closes.

I need to stress here that inside the dialog box I have put various input elements.
Here is the function that closes the dialog box(upon clicking the cancel button) along with another action to be accomplished.

  1. close: function() {//this function is called when I press the cancel button
  2.             this.$('#services').val('').trigger('chosen:updated');//this code updates the status of a jquey plugin named chosen
  3.             this.el.dialog('close');
The above function is triggered from this code:

  1.    render: function() {
  2.             var buttons = {'Ok': this.save};
  3.             if (!this.model.isNew()) {
  4.                 _.extend(buttons, {'Delete': this.destroy});
  5.             }
  6.             _.extend(buttons, {'Cancel': this.close});//with this code the above function is triggered            
  7.             this.el.dialog({
  8.                 modal: true,
  9.                 title: (this.model.isNew() ? 'Νew ' : 'Edit') + 'Appointment',
  10.                 buttons: buttons,
  11.                 open: this.open,
  12.                 width: 500
  13.             });

The problem has to do with the first code segment I gave you in line 3.
The code in line 3 is effective only upon pressing the cancel button and not when clicking the x symbol on the top right of the dialog box.

Why that happens?