Mount and unmount a LUKS volume using Bash functions

I have a LUKS encrypted volume that I only need from time to time. Opening it manually means typing the cryptsetup command, then the mount command, and remembering the correct device and mapper names every single time. Closing it is worse because a leftover shell sitting inside the mount point will keep the volume busy and the unmount will fail. The usual advice here is to add an /etc/crypttab and…