Newbie syntax error

Can someone identity my syntax error on line 45? I’m new to PHP. I’m sure it’s fairly simple. Thanks.

<?php
	/*
	Template Name: Blog-News-test
	*/
	?>

 <?php get_header(); ?>

<!-- BEGIN .post class -->
<div <?php post_class(); ?> id="page-<?php the_ID(); ?>">

    <?php $header_image = get_header_image(); if ( ! empty( $header_image ) ) { ?>
        <div class="feature-img page-header"><img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="<?php bloginfo('name'); ?>" /></div>
    <?php } ?>

    <!-- BEGIN .row -->
    <div class="row<?php if ( ! empty( $header_image ) ) { ?> header-active<?php } ?>">

    <?php if( is_user_logged_in() ) { ?>

    <?php if ( is_active_sidebar( 'blog-sidebar' ) ) : ?>

        <!-- BEGIN .eleven columns -->
        <div class="eleven columns">

            <!-- BEGIN .postarea -->
            <div class="postarea">

                <?php get_template_part( 'loop', 'blog' ); ?>

            <!-- END .postarea -->
            </div>

        <!-- END .eleven columns -->
        </div>

        <!-- BEGIN .five columns -->
        <div class="five columns">

            <?php get_sidebar('blog'); ?>

        <!-- END .five columns -->
        </div>

            <?php } ?>


    <?php else : ?>

        <!-- BEGIN .sixteen columns -->
        <div class="sixteen columns">

            <!-- BEGIN .postarea full -->
            <div class="postarea full">

                <?php get_template_part( 'loop', 'blog' ); ?>

            <!-- END .postarea full -->
            </div>

        <!-- END .sixteen columns -->
        </div>

    <?php endif; ?>

    <?php } else {

    // the user is not logged in
    // display the user login and registration
    if (function_exists('wpmem_securify'))
    {
        // display loging prompt as on other pages
        echo '<h1 class="entry-title">' . get_the_title() . "</h1>";
        wpmem_securify();
        the_content();
    }

} ?>


    <!-- END .row -->
    </div>

<!-- END .post class -->
</div>


<?php get_footer(); ?>

For me, the line 45 is

<?php } ?> 

Check to be sure that you closed all “if :” with “endif;” and all “if {” with “}”

On line 19 you have:

<?php if( is_user_logged_in() ) { ?> 

On line 21 you have:

<?php if ( is_active_sidebar( 'blog-sidebar' ) ) : ?> 

You should have a “endif;” that closes the line 21 before the “}” that closes the line 19.