That all depends on how you wrote your code.
Generally killing a job jerks the plug on your code and it immediately stops. That could be in the middle of a write or before a buffer gets flushed or a file is gracefully closed.
If you have tasks that HAVE to complete you can trap signals. Your code can then choose to ignore the signal and continue running, which isn't an optimal solution, or it could begin shutting down gracefully, flushing buffers, closing DB connections, closing files, etc., followed by quitting.
And, the reason ignoring an signal isn't good is some are sent by the OS to tell apps to shutdown prior to the system shutting down or restarting. Apps that don't close down can get the user or sysadmin pissed, who will then find a way to MAKE it quit, most likely in an ungraceful way.
Check out Signal for more info.