I think he was known as the duke of Gloucester, not Prince William of Gloucester. There was a Prince William of Gloucester in the 1700s, son of the duke of Gloucester (brother of George III), who later became duke. This one was one of the rare instances of being His Highness rather than His Royal Highness, since he was a great-grandson of a king.
He was never the Duke as he died two years before his father did. His younger brother inherited the title