Fixes DuplexStream deadlock
Fixes optimizes memory usage (frees memory after client finished session)