Your friend is allowed to resign and the company is not permitted to hold his passport.