Fix ViewHelper.close() to avoid null pointer in onDetachedFromWindow.