Power generation firms are to receive close to £1bn to ensure their plants stay open and prevent the lights going out in the coming years.