mutex: add magic checks

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Only attempt file unlock if we use locking

Fixes a segfault on exit, if file locking isn't used.

Signed-off-by: Jens Axboe <axboe@kernel.dk>