Fixed memory leak due to WPF bug.