Use our own PIL main to workaround a bug

The bug is that rtIOStreamClose function is never called at the end of
PIL simulation.