How to make player lose all upward momentum when jump key is released

The current code I have at the moment the movement works just as I like, except for that when the jump key is released the object will move upwards for some time until it starts falling. Even a small tap causes a jump to be ~50% of the max height. I’m not looking for this type of floatiness so I’d like to get rid of it and have the player fall as soon as the jump key is released.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScriptPlayerMove : MonoBehaviour {

    public float walkspd = 4.5f;
    private bool grounded;
    public float jump_force;
    public bool is_jumping;
    private float jump_counter;
    public float jump_time;
    public Transform feet_pos;
    public Transform head_pos;
    public float check_radius;
    public LayerMask ground;
    private Rigidbody2D rb;

    // Use this for initialization
    void Start ()
    {
        rb = GetComponent<Rigidbody2D>();
	}
	
	// Update is called once per frame
	void Update ()
    {
        grounded = Physics2D.OverlapCircle(feet_pos.position, check_radius, ground);

        if(grounded == true && Input.GetKeyDown(KeyCode.X))
        {
            is_jumping = true;
            jump_counter = jump_time;
            rb.velocity = Vector2.up * jump_force;
        }

        if(Input.GetKey(KeyCode.X) && is_jumping == true)
        {
            if(jump_counter > 0)
            {
                rb.velocity = Vector2.up * jump_force;
                jump_counter -= Time.deltaTime;
            }
            else
            {
                is_jumping = false;
            }
        }

        if(Input.GetKeyUp(KeyCode.X))
        {
            is_jumping = false;
        }

        if(Physics2D.OverlapCircle(head_pos.position, check_radius, ground))
        {
            is_jumping = false;
        }
    }

    void FixedUpdate()
    {
        float move_x = Input.GetAxisRaw("Horizontal");
        rb.velocity = new Vector2(move_x * walkspd, rb.velocity.y);
    }
}

try setting jump_force to 0 when the key is released

try something like this

bool keyflag = Input.GetKey(KeyCode.X);
if(keyflag && is_jumping == true)
{
                 if(jump_counter > 0)
                 {
                     rb.velocity = Vector2.up * jump_force;
                     jump_counter -= Time.deltaTime;
                 }
                 else
                 {
                     is_jumping = false;
                 }
}
else if (!keyflag && is_jumping == true)
{
                 is_jumping = false;
                 // set the rigidbody.velocity.y to 0 here         <=============
}

additionally, you may want to move all your physics manipulations to fixedupdate… or out of it. i’ve found that mixing them like that can produce some weird results.