Fix Interactive container hangs before exit when redirecting stdout #6509