added code to close