Close connection on stream
Make logging better for codec detection