Prevent error when closing modal dialog

No Issue
- Moved sendAction outside of the event handler as calling it
  from inside was generating an error in the console.

Error can be reproduced by causing a modal dialog to appear (delete post / delete tag) and then clicking "cancel."