Yes, you are allowed to change employers while your H-1B is pending. In this situation, since visa numbers are available, it would be better to file a Change of Status petition in order to avoid any complications due to the current employer withdrawing the pending petition.