applescript work but application fails, why?

Hi,

i have developed applescript to quit applications (preview, acrobat reader and adobe reader) on the basis of process id.

when i run my script, it closes all above applications. But when i run an application (developed and saves as application from same script ) , it fails to do required and passes an error as follows:

sh: line 1:kill: 507
520: no such pid error no:1

what is the reason and the solution for the above error???
please throw some light on it.

ukupatil
(India)

Browser: Safari 312
Operating System: Mac OS X (10.4)