Fix #135 - flush previous gl context before creating a new one