Fixes for named pipe related memory leaks