Memory effect from charge trapping in layered organic structures