Tesla nearly went under — twice