Fixes on application close