There is no window or outgoing message trigger that I know of. The only workaround that I can think of to execute automatically is really clunky. If you Cc yourself, the incoming Email will trigger an action rule to run an AppleScript. The speed at which the original message window closes depends on how soon you receive the Email. With small messages this can happen almost instantly; larger messages which include attachments will take longer, sometimes much longer.
The script assumes you are replying to a message from your Inbox. If replying from another mailbox substitute the name, for example: "— Work". The script will close every Mail window whose name property contains "— Inbox". It won't close the Message Viewer whose name property contains the word "Inbox" when the Inbox mailbox is selected, nor a New Message window, nor any window from another mailbox.
If you don't want to close every window whose name contains "— Inbox", you can reference a window by descriptive index or position relative to other windows:
close {the first window whose name contains "— Inbox"}
close {the 2nd window whose name contains "— Inbox"}
close {the front window whose name contains "— Inbox"}
close {the last window whose name contains "— Inbox"}
close {the window before the last window whose name contains "— Inbox"}
Save your script to /Users/<username>/Library/Application Scripts/com.apple.mail
tell application "Mail" try close {every window whose name contains "— Inbox"} end try end tell
To set up a Mail rule, from Mail's menu bar navigate to Mail > Preferences > Rules and click the "Add Rule" button. You can move the Email you Cc yourself to the trash by adding an action to your rule, unless you do send Email to yourself at other times. If you don't mind Emails you Cc yourself remaining in your Inbox, no need to move it. If you don't want Emails you Cc yourself in your Inbox, move it to another mailbox by adding an action to your rule. To Cc yourself automatically, from Mail's menu bar navigate to Mail > Preferences > Composing and select "Automatically Cc: myself".
Mail (Yosemite): Use rules to manage your inbox
Mail (Yosemite): Use scripts as rule actions