Refactor closeModal and openModal to modal object