Does it definitely close properly without the mattress? I have had that issue but mine was like that even with the mattress & extension pad removed.
If not then you could try adjusting the small hooks on the underside of the roof, they are fixed in place with a grub screw.
Moving them a few mm will result in more pressure on the back or front when the roof closes depending which way you move them.
Unfortunately I can't remember which way to move them to apply more pressure to the back. If you go the wrong way it will get worse but as long as you mark the original position first and only move 2 - 3mm at time then at lest you can get it back to how it is now. You also need to keep an eye on the front to make sure it's still closing properly as more pressure on the back results in less on the front.