Real life is not the movies. You will NOT be able to hurl a knife with lethal accuracy at 20 feet while someone is shooting at you. You will NOT be able to do cartwheels through a hail of automatic gunfire a la Resident Evil or Aeon Flux and then stab the gunman in the face.
Firearms are hands-down the most influential man-portable weapons ever created. Even early, unreliable firearms made melee weapons nearly obsolete after only a century or two. For example, the arquebus did to feudal Japan what the nuclear bomb did to modern warfare - it changed everything.
Also, closing the distance with a person wielding a gun does not give a knife the advantage, I don't know what some of you guys are smoking. A handgun is highly maneuverable, not to mention the guy can "stab" the knife-user with his barrel before shooting them. This is not MW2 where knives are insta-kill buttons at any range under 5 feet