Fixed issue when closing streams on Firefox