Added check for opened file. Otherwise plugin would throw error