Jahn-Teller-driven ferroelectricity and multiferroicity in GaV4Se8