Can I lock my forum from users to do some maintenance

Yes. This is called Maintenance mode, one of the General Server settings. It is often used during Forum Maintenance, or when installing or uninstalling forum modifications or themes.