Fix the bug of using NSInvocation to shutdown resources