WordPress files break if I edit them, but adding a closing PHP tag fixes it

WordPress files break if I edit them, but adding a closing PHP tag fixes it

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)