Look at command set:
https://www.itead.cc/wiki/Serial_Por...Slave)_:_HC-05
Be aware that there is several fw for HC-05. I have build programmer for them that worked on parallel port. So I could write FW that is best suited for me.
You have several options, you can:
  1. disconnect using AT+DISC
  2. reset module AT+RESET
  3. remove all auth devices, AT+ RMAAD.

I hope that this will help...