Remove end trailing whitespace (and ?>) to prevent starting output

Trailing whitespace lead to log messages like this:
Cannot modify header information - headers already sent by (output started at \/www\/owncloud\/apps\/roundcube\/lib\/RoundCubeAuthHelper.class.php:165) at \/www\/owncloud\/apps\/roundcube\/lib\/RoundCubeLogin.class.php#494
Omitting the closing ?> is generally considered the best way to achieve this - see e.g. http://stackoverflow.com/questions/4410704/why-would-one-omit-the-close-tag