This commit updates the template handling logic in the VideoEditor to remove any templates that start after the current frame and properly end templates that start at the current frame. This change improves the clarity and efficiency of template management during video editing sessions, ensuring that only relevant templates are active. Debug messages have been added to provide insights into the template removal and ending process.