Remove trailing whitespaces & closing php tag