Bug corrected in HTTP beans

Replaced content.encode() by to_bytes(content) to avoid an exception in
Python 3
Bugs corrected in the Shell

- Console: now checking if the bundle context is valid before
  stopping the framework
- Core: Python 3 behavior corrections