I have read that it is advised (especially with php 7) to not close the php files with ?>
Many of my WP php files end like this:
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Should I remove the closing tag and have something like this
<?php get_sidebar(); ?>
<?php get_footer();
at the end of my files?
Yes, please avoid closing PHP tags at the end of the file, not only with PHP 7, but with PHP 5 as well.
Reason is that if you close the tag, anything that is after the tag, even a blank line, will be sent to output and will make PHP to send headers as well preventing cookie to be set, redirect to work, feed to be valid, and so on.
I guess that you ever encountered a message like
Cannot modify header information – headers already sent by (output started at …) in … on line …
A closing ?>
at end of the file can be the cause.