Makes sure spawned process is destroyed in the end