Fix rules for closing FORTRAN module and typedef scopes