Subroutines in P systems and closure properties of their complexity classes