27weeks pregnant and I've lost my mucus plug. Cervix is closed still after trip to hospital. But can I have intercourse?

Yes. Loosing your mucus plug is a good sign, but doesn't necessarily mean much other than your pregnancy is progressing normally. Normal sexual activity is still fine, and safe, and sometimes encouraged in the later stages near term to help bring labor on. It is usually only after your water breaks that you run the risk of infection. Good luck and fortune with the remainder of your pregnancy/new baby.