Construct form with 'tab' without group indicate the 'with' and finalize...

... with one 'end'

For close tab with one only end:
      
             $formMapper
                ->tab('tab1', array('tabwith' => true))
                    ->add('username')
                    ->add('password')
                ->end()
                ->tab('tab2', array('tab' => true))
                    ->with('group1')
                        ->add('username')
                        ->add('password')
                    ->end()
                    ->with('group2', array('collapsed' => true))
                        ->add('enabled')
                        ->add('createdAt')
                    ->end()
                ->end();