How to close comment for all posts and pages in wordpress

There are 2 option to close comment in wordpress:

1. replace

<?php comments_template(); ?>

to

<?php //comments_template()?>

2. This is really good option to close comment.

add_filter( 'comments_open', 'my_comments_open', 10, 2 );

function my_comments_open( $open, $post_id ) {

	$post = get_post( $post_id );

	if ( 'page' == $post->post_type && 'post' == $post->post_type )
		$open = false;

	return $open;
}