How can I end this function?

here is the whole function:



function SWEP:Think()
	local reloadsound = math.random(1,3)
		if (self.Weapon:GetVar("reloadtimer",0) < CurTime()) then
			if (self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0) then
				self.Weapon:SetNetworkedBool("reloading",false)
				return
			end
			local vm = self.Owner:GetViewModel()
			local curtime = CurTime()
			local idletime = self:GetNextIdle()

			if ( idletime > 0 && CurTime() > idletime ) then

				vm:SendViewModelMatchingSequence( vm:LookupSequence( "ACT_VM_IDLE" ) )

				self:UpdateNextIdle()
			end
			self.Weapon:SetVar("reloadtimer",CurTime() + 0.5)
			self.Weapon:SendWeaponAnim(ACT_VM_RELOAD)
			self.Weapon:EmitSound("weapons/reload"..reloadsound..".wav")
			self.Owner:RemoveAmmo(1,self.Primary.Ammo,false)
			self.Weapon:SetClip1(self.Weapon:Clip1() + 1)
			if (self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0) then
			timer.Simple(0.6, function()
			if (IsValid(self.Weapon) and self.Weapon:Clip1() == self.Primary.ClipSize) then
                	self.Weapon:SendWeaponAnim(ACT_SHOTGUN_PUMP)
			self.Weapon:EmitSound("weapons/hl1/scock1.wav")


by typing “end”(no quotes) twice after


self.Weapon:EmitSound("weapons/hl1/scock1.wav")