change cancel function to close