sleep

After almost giving up on this, I finally was able to suspend/recover my Macintosh computer running Linux on it.

#!/bin/bash
if grep -q closed /proc/acpi/button/lid/*/state
then
 /usr/sbin/pm-suspend
fi

if grep -q open /proc/acpi/button/lid/*/state
then
    /usr/bin/i3-msg restart
fi

All that was needed for this to work was a 3.10+ kernel (I had luck with both 3.18 and 4.10). Apart from that, I needed pm-utils that can suspend and wake up your machine.