timer: don't actrually delete a timer when there is event pending

This add a event pending count in the timer and once there is a event
pushed into the queue, it get increased and when it reached in app, the
count will be decreased. When deleting timer, RTGUI won't delete the one
that count is greater than zero. The timer will be cleaned up in app
eventually.
filedialog: fix compile error in simulator