We have made a closure function according to our understanding, kindly go through it and lets us know if something is not correct.