lua : delegate post-import events to a sub-thread

this avoids locking the UI when importing single images instead
of directories
Fix small memleak introduced in last commit
PNG: hopefully fix support for libpng-1.5+ version