Closing of a function