There is no simple way to do this: on program termination - graceful or not - the operating system will clean up system resources that the program was using. For example, this means that any TCP connections that were established will be properly terminated by the operating system, informing the peer of the closing of your side of the sockets.
If this is about a networked application, you could consider using a firewall to block all in- and outgoing traffic for your application, from the peers perspective this will look as if your machine has just fallen off the earth.