Run arbitrary functions & commands asynchronously before process termination, programatically or via CLI