Please replace the TargetObject= {Binding ElementName=window}" as TargetObject="{Binding RelativeSource={RelativeSource AncestorType=Window}}". You can close the Windows with this style, but not for Page.
By the way, you can use add Microsoft.xaml.behaviors.WPf in NuGet to replace the two dlls which I provide above and do little modify like below:
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
…….
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:CallMethodAction TargetObject="{Binding RelativeSource={RelativeSource AncestorType=Window}}" MethodName="Close"/>
</i:EventTrigger>
</i:Interaction.Triggers>