Handle standalone termination in a separate thread