Clear reference to application on teardown

See issue #23.