Closing fixes.

Application no longer runs once the form is closed.