Fix was removing the newline from the end comment
Fix now accounts for a comment after the scope closer (like //end foreach)