In an HTML document when you open a tag and “close tag” with ALT+. or CMD+ALT+. it will close the last tag opened BEFORE the open tag.
e.g. in the following code:
<head>
<script>
[press shortcut]
generates:
<head>
<script>
</head>