Fixed error on exit
Fix for taking care of deleting widgets when they are closed