improved close behaviour with proper error messages, Android: call close via onDestroy