Several bugfixes in auto complete: close tags