The transition from AGB to post-AGB evolution as observed by AKARI and Spitzer