yes exactly. the crash happens only when closing the app. Until then every thing works fine. Before It was running fine but when I added the above function my app started crashing. So I then removed the function but still the crash happens when closing the application.