Fixed issue where closing tags were not being written.