Allow closing modal programmatically

This is regarding issue #252 

I added the function `closeModal()` to programmatically close the modal
Updated the documentation as well.