Keras save model FailedPreconditionError
The error was caused because after training the model I opened another tensorflow session to save predictions to dataset and put model.save('model.h5') after. So moving this line up, right after the model finished training solved the problem.