Close streams to avoid leakage