fix for chaining popup views

The callbacks were not getting called in case of multiple popups being called one after the other. The change in the order of function calling and setting it nil.. helps to resolve it..