Try catch exception during closing