fixing close bug of contract window