Easiest way to gently kill an intermittently unresponsive application?
You should be able to use AppleScript:

tell application "name" to quit


Using 'to quit' rather than 'to force quit' will mean that it won't be forced regardless of whether the app is unresponsive—rather, it will ask the app to quit whenever it can.

With shell:

osascript -e 'tell application "name" to quit'