Cannot read property 'close' of null