Ensure templates compile when ending with blocks
Ensure we keep template file info on exceptions, closes #466