Added an undefined check in the condition that checks if the notificatio...

...n is closing before it's open.  Without this check we were getting a javascript undefined error on the next line when '.created' was trying to be run on an undefined object.