This guide will show you several ways in which you can lock your Mac.
macOS Mac OS X lock Mac Lock display