Remotely Quit Remote Desktop

I often need to remotely control a Mac that has the Remote Desktop application running on it. Thus I need to create a script to kill it remotely. The following command gives me the process number (PID) on the remote machine when logged in via SSH. What I need to know is how to pass that number to kill -3 to quit it with one command, bad thing can happen if you make a typo on PID

ps -ax | grep "Remote Desktop.app" | grep -v grep | awk '{print $1}'
Remotely Quit Remote Desktop
 
 
Q