Macbook doesn't stay asleep when lid is closed
One possible cause is that the sensor to detect lid opening can trigger by mistake. If so, you can disable it by going into Terminal.app and typing:

sudo pmset -a lidwake 0


Note that this means the Mac will no longer automatically wake when you open it. Instead you would need a key press or mouse click to wake.