Make sure all sub-tasks have been closed
Problem
Jira Cloud conveniently asks you whether to close an issue once all sub-tasks have been closed. However, it will allow you to close an issue, even though it has open sub-tasks.
Solution
Conditions work best here, so add a custom condition to the transition that closes your issue and use the following Jira Expression:
issue.subtasks
.filter(s => s.status.name != 'Done')
.length == 0