Scotland's most notorious prison could be kept open, even though a replacement is being built at a cost of nearly £1billion.