Add option to allow closing the spider upon duplicate insertion in mongodb.

I had this requirement for my project and decided to share what I have done in this pull request.
I would be happy if you are ok to merge this feature.
Let me know if you want some modifications before.