Bitcoin nears $40,000 mark as cryptos consolidate gains