Adding viewClose event