Try this:
<div class="all-posts">
<div class="post-group>
<?php $i = 0;
if (have_posts() ) : while ( have_posts() ) : the_post();
if ($i%4 == 0) echo '</div><div class="post-group">'; ?>
<div class="post">
<?php the_title(); ?>
</div>
<?php $i++;
endwhile; endif; ?>
</div><!-- end post-group -->
</div><!-- end all-posts -->
You code was closing, opening and closing div on multiples of 4.
Anyway, I’m guessing all this is about layout, so you should be able to find a better solution only with CSS.