apl_gradebook: Add apl_openbook comment
apl_gradebook: Work on apl_openbook implementation

Allocates a gradebook and handles clean up in error cases.
Also added some private functions for use in such cases.