Most likely, you have frayed and broken wires inside the wiring harness to the trunk lid. The wire fatigues where it bends when you open and close the trunk.
Common problem if anyone has ever used the trunk a lot. The license plate lights are on the same circuit as your tail lights, so if that wire shorts out, it blows the fuse to your tail lights.