Revert previous memory leak fix as leak is still fixed without and it blocks code trying to block closing a dialog