Implemented signal handling for *nix-equivalent cleanup on termination.