[CAT-963] Can't download programs

stream was closed at wrong position.