Issues with opening port for bash script and automatically closing the process

Hey, perhaps someone ran into this before and can help me out. Basically I’m opening a port that runs a bash script for launching chrome. It works fine on my local mac, chrome gets started, when the Port is sent Process.exit(pid, :normal), the chrome instance is killed.

Now I’ve deployed this umbrella app to ubuntu, it’s working, but chrome instances are not being killed when I .exit() the process. Any ideas?

#!/bin/sh
google-chrome --attrs --flag-switches-begin --headless --disable-gpu --remote-debugging-port="$1" --user-agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36" --user-data-dir=/dev/null --disable-extensions --disable-internal-flash --disable-bundled-ppapi-flash --incognito --ignore-certificate-errors --noerrdialogs --enable-internal-media-session --flag-switches-end & pid=$!
while read line ; do
  :
done
kill -KILL $pid

And what calls that script:

def handle_cast({:start_session, reference, %{"pageUrl" => page_url}}, %{session: false} = state) do
    IO.puts("Hound :start_session for reference: #{inspect page_url}")
    port = find_available_port()
    path = Path.absname(chrome_path(), Application.app_dir(:app_chrome))
    chrome = Port.open({:spawn_executable, path},
      [:binary, :use_stdio, :stderr_to_stdout, :exit_status, args: ["#{port}"]])
    full_page_url = base_url() <> page_url
    {:os_pid, pid} = Port.info(chrome, :os_pid)
    case Regex.named_captures(~r/listening\son\s?(?<url>.*)\s/, handle_output(chrome)) do
       %{"url" => url} ->
        GenServer.cast(ChannelerServer, {:start_socket, %{port: port, reference: reference, page_url: full_page_url}})
        GenServer.call(HoundKeeper, {:update, reference, chrome, pid, port, url}, 60_000)

      _ -> {:error, "Not Active"}
    end
    {:noreply, state}
  end

Ubuntu is 16.04
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:10] [hipe] [kernel-poll:false]
Elixir 1.5.2

Any ideas? Thanks