Fix memory leak of WeakHandle