Error in move hook

I dont know what problem is. Can you help me?
Code:

--server
util.AddNetworkString("KEY_I")

net.Receive("KEY_I", function(len,ply)

	ply:ConCommand("showpoints")

end)

--client
f = vgui.Create("DFrame")
f:Close()
function PointsDraw()

	local ply = LocalPlayer()

	local w = 506
	local h = 512

	f = vgui.Create("DFrame")
	f:SetSize(w,h)
	f:SetPos( (ScrW()/2) - (w/2), (ScrH()/2) - (h/2) )
	f:SetTitle("points")
	f:SetDraggable(true)
	f:ShowCloseButton(true)
	f:MakePopup()
	f.Paint = function()
		SKINS:DrawFrame(f:GetWide(),f:GetTall())
	end


end

concommand.Add("showpoints", PointsDraw)

print(f:IsActive())

hook.Add("Move", "GDFGDF", function(ply,mv)

	if (input.IsKeyDown(KEY_I) and f:IsActive() == false) then
		print("yes")
		net.Start("KEY_I")
		net.SendToServer("KEY_I")
	end

end)

Error(when im press I):
[add] addons/add/lua/autorun/client/cl_experience.lua:704: attempt to call method ‘IsActive’ (a nil value)

  1. fn - addons/add/lua/autorun/client/cl_experience.lua:704
  2. unknown - addons/ulib/lua/ulib/shared/hook.lua:109

Your derma frame has just not been created. As long as you haven’t run this command, then you will get an error.

I do not quite understand. I created it, it seems.

f = vgui.Create("DFrame")
f:Close()

No, you created your derma frame and then closed it (PANEL:Close can destroy the frame internally with DFrame:SetDeleteOnClose - Garry's Mod Wiki)