Fix bug preventing close events