Kill background process on process exit

Make sure that the background process is killed when the main process
exits.