after_script: missing environment variable sharing between before_script - kill ssh-agent on windows - shell runner

I just tested the recently merged !153 (merged) after_script support. I need this to clean up ssh-agent's spawned on windows machines by the before_script

before_script:
  # Add ssh credentials
  - eval $(ssh-agent -s)
  - ssh-add <(echo "$SSH_PRIVATE_KEY")
  - mkdir -p ~/.ssh
  - echo -e "Host *\n\tStrictHostKeyChecking no\n\tUser ${SSH_USER}\n" > ~/.ssh/config

which is used to provide ssh credentials in each job.

Now if I use

after_script:
  - ssh-agent -k

to kill the forked ssh-agent I get

Running after script...
$ ssh-agent -k
SSH_AGENT_PID not set, cannot kill agent

Although the environment variable SSH_AGENT_PID has been exported in the before_script. This is an issue because I need to kill the ssh-agent.exe forked in the shell jobs run by windows. At some point too many processes were spawned and builds start to fail until I kill all processes with taskkill /F /IM ssh-agent.exe /T in a cmd.exe. Is it possible to share variables between before / after script?