wrap code in a synchronised statement block

The modification is implemented due to the problem described in JIRA http://developer.appcelerator.com/question/164513/application-crashes-on-resume

Could you please validate if this change is appropriate?