When you call Application.Current.Shutdown you may expect to shutdown the application immediately. But it doesn't. Application.Shutdown is async in nature. So it may take few moments to shut down application. So not to execute code after shutdown call, you need to put a return statement. This return statement will make sure that the code returns. You can also use Thread.Sleep so that the shutdown method gets time to close the application. But you can't grantee how much time you will keep the thread sleep.
The issue is already reported here.