To avoid any unwanted matches with grep (e.g. ports 1999 and 19999), use:
$ lsof -i:$port | grep LISTEN
$ kill $pid $ lsof -i:$port | grep LISTEN
$ kill $pid lsof -s TCP:LISTEN -i :$port