How do you close an ASP.NET MVC page from the controller?

Like such:

[HttpPost]
public ActionResult MyController(Model model)
{
    //do stuff
    ViewBag.Processed = true;
    return View();
}

The view:

<%if(null!=ViewBag.Processed && (bool)ViewBag.Processed == true){%>
<script>
    window.close();
</script>
<%}%>

You could return a View that has the following javascript (or you could return a JavaScript result) but I prefer the former.

public ActionResult SubmitForm()
{
    return View("Close");
}

View for Close:

<body>
    <script type="text/javascript">
        window.close();
    </script>
</body>

Here is a way to do it directly in your Controller but I advise against it

public ActionResult SubmitForm()
{
    return JavaScript("window.close();");
}