Fix close on crash patch which was  posted on the mailing list by Filipe...

... Coelho