Close stream after process close